Merge branch 'Feature/salary-aid/client-api' into Main
Some checks failed
Deploy Development ASP.NET Core App to IIS / build-and-deploy (push) Has been cancelled
Some checks failed
Deploy Development ASP.NET Core App to IIS / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -433,7 +433,7 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
var checkouts = _checkoutRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
command.WorkshopId, employeeId, calculationDateGr).GetAwaiter().GetResult();
|
||||
|
||||
checkouts?.SetAmountConflict(true);
|
||||
checkouts?.SetAmountConflict(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using _0_Framework.Application;
|
||||
using CompanyManagement.Infrastructure.Excel.SalaryAid;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Build.Evaluation;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
@@ -60,7 +61,7 @@ public class SalaryAidController:ClientBaseController
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpGet("edit")]
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<EditSalaryAidRequest> EditDetails(long id)
|
||||
{
|
||||
var data = _salaryAidApplication.GetDetails(id);
|
||||
@@ -88,6 +89,28 @@ public class SalaryAidController:ClientBaseController
|
||||
|
||||
return validation;
|
||||
}
|
||||
[HttpPost("create-from-excel")]
|
||||
public async Task<ActionResult<OperationResult>> OnPostCreateFromExcelData(List<SalaryAidImportData> data)
|
||||
{
|
||||
var commands = data.Select(x => new CreateSalaryAidViewModel()
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
EmployeeIds = [x.EmployeeId],
|
||||
SalaryDateTime = x.SalaryAidDateTime,
|
||||
NationalCode = x.NationalCode,
|
||||
CalculationMonth = x.calculationMonth,
|
||||
CalculationYear = x.calculationYear
|
||||
}).ToList();
|
||||
|
||||
OperationResult result = await _salaryAidApplication.CreateRangeAsync(commands);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
result.IsSuccedded,
|
||||
result.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class ValidateExcelRequest
|
||||
|
||||
Reference in New Issue
Block a user