Raspisanie/Zurnal/Date/Repository/SQLRepos/SQLNado.cs

46 lines
1.4 KiB
C#
Raw Normal View History

2024-11-11 11:41:23 +00:00
2024-11-07 11:31:00 +00:00
using Zurnal.Date.LocalDate;
using Zurnal.domain.Models;
using Zurnal.RemaDateBase.DateDao;
2024-11-11 11:41:23 +00:00
namespace Zurnal.Date.Repository.SQLRepos
2024-11-07 11:31:00 +00:00
{
2024-11-11 11:41:23 +00:00
public class SQLGroupRepositoryImpl : IGroupRepository
2024-11-07 11:31:00 +00:00
{
private readonly RemoteDateBaseContext _remoteDataBaseContext;
public SQLGroupRepositoryImpl(RemoteDateBaseContext remoteDataBaseContext) {
_remoteDataBaseContext = remoteDataBaseContext;
}
public List<GroupDao> AllGroup => throw new NotImplementedException();
2024-11-11 11:41:23 +00:00
List<GroupDao> IGroupRepository.AllGroup => throw new NotImplementedException();
2024-11-07 11:31:00 +00:00
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<GroupLocalEntity> GetAllGroup()
{
return _remoteDataBaseContext.Group.Select(group => new GroupLocalEntity{
Id = group.Id,
Name = group.GroupName}
).ToList();
}
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
2024-11-11 11:41:23 +00:00
List<GroupLocalEntity> IGroupRepository.GetAllGroup()
2024-11-07 11:31:00 +00:00
{
throw new NotImplementedException();
}
}
2024-11-11 11:41:12 +00:00
2024-11-07 11:31:00 +00:00
}