34 lines
722 B
C#
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;
|
|
}
|
|
}
|
|
|
|
}
|