presence/domain/GroupUseCase.cs

30 lines
727 B
C#
Raw Permalink Normal View History

2024-11-08 08:08:54 +00:00
using Data.Models;
using Data.Repository;
using domain.Models.RequestModels;
namespace domain;
public class GroupUseCase
{
private readonly IGroupRepository _repository;
public GroupUseCase(IGroupRepository repository) {
_repository = repository;
}
public void addGroup(GroupAddRequest groupAddRequest) {
GroupLocalEntity groupLocalEntity = new GroupLocalEntity { Name = groupAddRequest.Name };
_repository.AddGroup(groupLocalEntity);
}
public List<GroupResponse> getAllGroup(){
return _repository.GetAllGroup().Select(group =>
new GroupResponse {
Id = group.Id,
Name = group.Name
}
).ToList();
}
}