40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using _0_Framework.Application;
|
|
using Company.Domain.EmployeeClientTempAgg;
|
|
using CompanyManagment.App.Contracts.EmployeeClientTemp;
|
|
|
|
namespace CompanyManagment.Application;
|
|
|
|
public class EmployeeClientTempApplication : IEmployeeClientTempApplication
|
|
{
|
|
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
|
|
|
public EmployeeClientTempApplication(IEmployeeClientTempRepository employeeClientTempRepository)
|
|
{
|
|
_employeeClientTempRepository = employeeClientTempRepository;
|
|
}
|
|
|
|
public OperationResult Create(CreateEmployeeClientTemp command)
|
|
{
|
|
var op = new OperationResult();
|
|
var fullName = $"{command.FName} {command.LName}";
|
|
var employeeClientTemp = new EmployeeClientTemp(command.WorkshopId, command.StartWorkTime, command.EmployeeId, command.MaritalStatus, fullName);
|
|
|
|
_employeeClientTempRepository.Create(employeeClientTemp);
|
|
_employeeClientTempRepository.SaveChanges();
|
|
|
|
return op.Succcedded();
|
|
}
|
|
|
|
public EmployeeClientTempGetDetailsViewModel GetDetails(long employeeId, long workshopId)
|
|
{
|
|
return _employeeClientTempRepository.GetDetails(employeeId, workshopId);
|
|
}
|
|
|
|
public async Task<List<EmployeeClientTempViewModel>> GetByEmployeeId(long employeeId)
|
|
{
|
|
return await _employeeClientTempRepository.GetByEmployeeId(employeeId);
|
|
|
|
}
|
|
} |