presense/Demo/Domain/UseCase/GroupUseCase.cs
2024-10-18 16:23:16 +03:00

34 lines
722 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Demo.Domain.Models;
namespace Demo.Domain.UseCase
{
public class GroupUseCase
{
private List<Group> _groups = new List<Group>();
private int _nextId;
public IEnumerable<Group> GetAllGroups() => _groups;
public void AddGroup(string name)
{
_groups.Add(new Group { Id = _nextId++, Name = name });
}
public void UpdateGroupName(Guid id, string newName, bool Id)
{
var group = _groups.FirstOrDefault(g => Id);
if (group != null)
group.Name = newName;
}
}
}