Demo/Domain/UseCase/GroupUseCase.cs
2024-10-23 10:06:56 +03:00

32 lines
971 B
C#

using Posechaemost.Data.LocalData.Entity;
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
{
private GroupRepositoryImpl _repositoryGroupImpl;
public GroupUseCase(GroupRepositoryImpl repositoryGroupImpl)
{
_repositoryGroupImpl = repositoryGroupImpl;
}
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
.Select(it => new Group { 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(name, id);
}
}
}