Demo/Data/Repository/GroupRepositoryImpl.cs

32 lines
1.0 KiB
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;
}
}
}