31 lines
973 B
C#
31 lines
973 B
C#
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);
|
|
}
|
|
|
|
public GroupLocalEntity? UpdateUserById(GroupLocalEntity groupUpdateLocalEntity)
|
|
{
|
|
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];
|
|
}
|
|
}
|
|
} |