2024-12-19 17:36:57 +00:00
|
|
|
|
using Demo.Data.Exceptions;
|
|
|
|
|
using Demo.Data.LocalData;
|
|
|
|
|
using Demo.Data.RemoteData.RemoteDataBase.DAO;
|
2024-10-19 21:39:57 +00:00
|
|
|
|
using Demo.Data.Repository;
|
|
|
|
|
using Demo.domain.Models;
|
2024-12-19 17:36:57 +00:00
|
|
|
|
using domain.Models.ResponseModels;
|
2024-10-19 21:39:57 +00:00
|
|
|
|
|
|
|
|
|
namespace Demo.Domain.UseCase
|
|
|
|
|
{
|
|
|
|
|
public class GroupUseCase
|
|
|
|
|
{
|
2024-11-17 16:24:01 +00:00
|
|
|
|
private readonly IGroupRepository _repositoryGroupImpl;
|
2024-10-19 21:39:57 +00:00
|
|
|
|
|
2024-11-17 16:24:01 +00:00
|
|
|
|
public GroupUseCase(IGroupRepository repositoryGroupImpl)
|
|
|
|
|
{
|
|
|
|
|
_repositoryGroupImpl = repositoryGroupImpl;
|
|
|
|
|
}
|
2024-10-19 21:39:57 +00:00
|
|
|
|
|
2024-12-19 17:36:57 +00:00
|
|
|
|
public List<GroupResponse> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
|
|
|
|
|
.Select(it => new GroupResponse { Id = it.Id, Name = it.Name }).ToList();
|
2024-11-17 16:24:01 +00:00
|
|
|
|
|
2024-12-19 17:36:57 +00:00
|
|
|
|
public bool UpdateGroupName(String id, String name1)
|
2024-11-17 16:24:01 +00:00
|
|
|
|
{
|
2024-12-19 17:36:57 +00:00
|
|
|
|
return _repositoryGroupImpl.UpdateGroupById(int.Parse(id), name1);
|
2024-10-19 21:39:57 +00:00
|
|
|
|
}
|
2024-12-19 17:36:57 +00:00
|
|
|
|
public bool AddGroup(String name, int id)
|
2024-10-19 21:39:57 +00:00
|
|
|
|
{
|
2024-12-19 17:36:57 +00:00
|
|
|
|
return _repositoryGroupImpl.AddGroup(new GroupDao { Name = name, Id = id });
|
2024-12-05 09:30:01 +00:00
|
|
|
|
}
|
2024-11-17 16:24:01 +00:00
|
|
|
|
}
|
2024-12-19 17:36:57 +00:00
|
|
|
|
}
|