presence_new/domain/UseCase/GroupUseCase.cs

42 lines
1.3 KiB
C#
Raw Normal View History

2024-11-16 12:02:17 +00:00
using domain.Models.ResponseModels;
using presence.data.LocalData.Entity;
using presence.data.RemoteData.RemoteDataBase.DAO;
using presence.data.Repository;
using presence.domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace presence.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, String id)
{
return _repositoryGroupImpl.AddGroup(new GroupDao { Name = name, Id = int.Parse(id) });
}
// public List<GroupResponse> getAllGroup()
// {
// return _repositoryGroupImpl.GetAllGroup()
// .Select(it => new GroupResponse { Id = it.Id, Name = it.Name }).ToList();
// }
}
}