123/123/Data/ReportsHistory/GroupRepositoty.cs

34 lines
958 B
C#
Raw Normal View History

using _123.Data.LocalData.Entity;
using _123.Data.LocalData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _123.Data.ReportsHistory
{
public class GroupRepositoryImpl
{
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
2024-10-18 08:32:27 +00:00
public GroupLocalEntity? UpdateGroup(String name)
{
GroupLocalEntity? groupLocal = GetAllGroups()
2024-10-18 08:32:27 +00:00
.Where(x => x.Name == name).FirstOrDefault();
if (groupLocal == null) return null;
2024-10-18 08:32:27 +00:00
groupLocal.Name = name;
return groupLocal;
}
2024-10-18 09:30:44 +00:00
public GroupLocalEntity AddGroup(String name, String id)
{
GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault();
groupLocal.Name = name;
groupLocal.ID = int.Parse(id);
return groupLocal;
}
}
}