using Zurnal.Date.LocalDate; using Zurnal.domain.Models; using Zurnal.RemaDateBase.DateDao; namespace Zurnal.Date.Repository.SQLRepos { public class SQLGroupRepositoryImpl : IGroupRepository { private readonly RemoteDateBaseContext _remoteDataBaseContext; public SQLGroupRepositoryImpl(RemoteDateBaseContext remoteDataBaseContext) { _remoteDataBaseContext = remoteDataBaseContext; } public List AllGroup => throw new NotImplementedException(); List IGroupRepository.AllGroup => throw new NotImplementedException(); public bool AddGroup(GroupLocalEntity newGroup) { GroupDao groupDao = new GroupDao { GroupName = newGroup.Name }; var result = _remoteDataBaseContext.Group.Add(groupDao); if (result != null) { _remoteDataBaseContext.SaveChanges(); return true; } return false; } public List GetAllGroup() { return _remoteDataBaseContext.Group.Select(group => new GroupLocalEntity{ Id = group.Id, Name = group.GroupName} ).ToList(); } public List GetAllGroups() => LocalStaticData.groups; List IGroupRepository.GetAllGroup() { throw new NotImplementedException(); } } }