Demo/Domain/UseCase/GroupUseCase.cs

33 lines
1.1 KiB
C#
Raw Normal View History

using Posechaemost.Data.LocalData.Entity;
2024-11-06 04:10:09 +00:00
using Posechaemost.Data.RemoteData.RemoteDataBase.DAO;
using Posechaemost.Data.Repository;
using Posechaemost.Domain.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Posechaemost.Domain.UseCase
{
public class GroupUseCase
{
2024-11-06 04:10:09 +00:00
private SQLGroupRepositoryImpl _repositoryGroupImpl;
2024-11-06 04:10:09 +00:00
public GroupUseCase(SQLGroupRepositoryImpl repositoryGroupImpl)
{
_repositoryGroupImpl = repositoryGroupImpl;
}
2024-11-06 04:10:09 +00:00
public List<GroupDao> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
.Select(it => new GroupDao { Id = it.Id, Name = it.Name}).ToList();
2024-10-23 07:06:56 +00:00
public bool UpdateGroupName(String id, String name1) {
return _repositoryGroupImpl.UpdateGroupById(int.Parse(id), name1);
}
2024-10-23 07:06:56 +00:00
public bool AddGroup(String name, String id)
2024-10-18 08:43:40 +00:00
{
2024-11-06 04:10:09 +00:00
return _repositoryGroupImpl.AddGroup(new GroupDao { Name = name, Id = int.Parse(id) });
2024-10-18 08:43:40 +00:00
}
}
}