using presence.Data.LocalData.Entity; using presence.Data.LocalData; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using presence.Data.RemoteData.RemoteDatabase.DAO; namespace presence.Data.Repository { public class GroupRepositoryImpl: IGroupRepository { public List GetAllGroups() => LocalStaticData.groups; public bool AddGroup(String name,String Id) { GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault(); groupLocal.Name = name; groupLocal.ID = int.Parse(Id); return true; } public List GetAllGroup() { return GetAllGroup(); } public GroupLocalEntity GetGroupById(int groupID) { GroupLocalEntity? groupLocal = GetAllGroups() .Where(x => x.ID == groupID).FirstOrDefault(); if (groupLocal == null) return null; return groupLocal; } public bool RemoveGroupById(int groupID) { GroupLocalEntity? userLocal = GetAllGroups() .Where(x => x.ID == groupID).FirstOrDefault(); if (userLocal == null) return false; return GetAllGroups().Remove(userLocal); } public bool UpdateGroupById(int groupID, String name) { GroupLocalEntity? groupLocal = GetAllGroups() .Where(x => x.ID == groupID).FirstOrDefault(); if (groupLocal == null) return false; groupLocal.Name = name; return true; } List IGroupRepository.GetAllGroup() { throw new NotImplementedException(); } GroupDao IGroupRepository.GetGroupById(int groupID) { throw new NotImplementedException(); } } }