presense/Demo/Domain/UseCase/GroupUseCase.cs

34 lines
722 B
C#
Raw Normal View History

2024-10-18 13:23:16 +00:00
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;
}
}
}