2024-10-17 11:46:19 +00:00
|
|
|
using Demo.Domain.Models;
|
|
|
|
|
|
|
|
using Demo.Data.LocalData;
|
|
|
|
|
|
|
|
namespace Demo.Data.Repository
|
|
|
|
{
|
|
|
|
public class GroupRepositoryImpl
|
|
|
|
{
|
|
|
|
// public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
|
|
|
public GroupRepositoryImpl() {
|
|
|
|
|
|
|
|
GetAllGroups = LocalStaticData.groups;
|
|
|
|
}
|
|
|
|
public List<GroupLocalEntity> GetAllGroups
|
|
|
|
{ get; set; }
|
|
|
|
|
|
|
|
public void CreateNewGroup(GroupLocalEntity groupLocalEntity)
|
|
|
|
{
|
|
|
|
GetAllGroups.Add(groupLocalEntity);
|
|
|
|
}
|
|
|
|
|
2024-10-17 12:13:34 +00:00
|
|
|
public GroupLocalEntity? UpdateGroup(GroupLocalEntity groupUpdateLocalEntity)
|
2024-10-17 11:46:19 +00:00
|
|
|
{
|
|
|
|
int index = GetAllGroups.FindIndex(x => x.ID == groupUpdateLocalEntity.ID);
|
|
|
|
if (index == -1) return null;
|
|
|
|
GetAllGroups[index].Name = groupUpdateLocalEntity.Name;
|
|
|
|
Console.WriteLine($"Обновленный Name: {GetAllGroups[index].Name}");
|
|
|
|
return GetAllGroups[index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|