Demo/Data/Repository/GroupRepositoryImpl.cs
2024-10-18 11:43:40 +03:00

33 lines
996 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Posechaemost.Data.LocalData;
using Posechaemost.Data.LocalData.Entity;
namespace Posechaemost.Data.Repository
{
public class GroupRepositoryImpl
{
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
public GroupLocalEntity? UpdateGroup(String name)
{
GroupLocalEntity? groupLocal = GetAllGroups()
.Where(x => x.Name == name).FirstOrDefault();
if (groupLocal == null) return null;
groupLocal.Name = name;
return groupLocal;
}
public GroupLocalEntity? AddGroup(String name, String id)
{
GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault();
groupLocal.Name = name;
groupLocal.Id = int.Parse(id);
return groupLocal;
}
}
}