31 lines
973 B
C#
31 lines
973 B
C#
using Demo.Data.Exceptions;
|
|
using Demo.Data.LocalData;
|
|
using Demo.Data.RemoteData.RemoteDataBase.DAO;
|
|
using Demo.Data.Repository;
|
|
using Demo.domain.Models;
|
|
using domain.Models.ResponseModels;
|
|
|
|
namespace Demo.Domain.UseCase
|
|
{
|
|
public class GroupUseCase
|
|
{
|
|
private readonly IGroupRepository _repositoryGroupImpl;
|
|
|
|
public GroupUseCase(IGroupRepository repositoryGroupImpl)
|
|
{
|
|
_repositoryGroupImpl = repositoryGroupImpl;
|
|
}
|
|
|
|
public List<GroupResponse> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
|
|
.Select(it => new GroupResponse { Id = it.Id, Name = it.Name }).ToList();
|
|
|
|
public bool UpdateGroupName(String id, String name1)
|
|
{
|
|
return _repositoryGroupImpl.UpdateGroupById(int.Parse(id), name1);
|
|
}
|
|
public bool AddGroup(String name, int id)
|
|
{
|
|
return _repositoryGroupImpl.AddGroup(new GroupDao { Name = name, Id = id });
|
|
}
|
|
}
|
|
} |