Demo/Data/Repository/GroupRepositoryImpl.cs

27 lines
845 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(GroupLocalEntity groupUpdateLocalEnity)
{
GroupLocalEntity? groupLocal = GetAllGroups()
.Where(x => x.Id == groupUpdateLocalEnity.Id).FirstOrDefault();
if (groupLocal == null) return null;
groupLocal.Id = groupUpdateLocalEnity.Id;
groupLocal.Name = groupUpdateLocalEnity.Name;
return groupLocal;
}
}
}