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

This commit is contained in:
2026-02-05 15:01:28 +03:30
2 changed files with 25 additions and 2 deletions

View File

@@ -433,7 +433,7 @@ public class SalaryAidApplication : ISalaryAidApplication
var checkouts = _checkoutRepository.GetByWorkshopIdEmployeeIdInDate( var checkouts = _checkoutRepository.GetByWorkshopIdEmployeeIdInDate(
command.WorkshopId, employeeId, calculationDateGr).GetAwaiter().GetResult(); command.WorkshopId, employeeId, calculationDateGr).GetAwaiter().GetResult();
checkouts?.SetAmountConflict(true); checkouts?.SetAmountConflict(true);
} }
} }

View File

@@ -2,6 +2,7 @@ using _0_Framework.Application;
using CompanyManagement.Infrastructure.Excel.SalaryAid; using CompanyManagement.Infrastructure.Excel.SalaryAid;
using CompanyManagment.App.Contracts.SalaryAid; using CompanyManagment.App.Contracts.SalaryAid;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Build.Evaluation;
using ServiceHost.BaseControllers; using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers; namespace ServiceHost.Areas.Client.Controllers;
@@ -60,7 +61,7 @@ public class SalaryAidController:ClientBaseController
return result; return result;
} }
[HttpGet("edit")] [HttpGet("{id}")]
public ActionResult<EditSalaryAidRequest> EditDetails(long id) public ActionResult<EditSalaryAidRequest> EditDetails(long id)
{ {
var data = _salaryAidApplication.GetDetails(id); var data = _salaryAidApplication.GetDetails(id);
@@ -88,6 +89,28 @@ public class SalaryAidController:ClientBaseController
return validation; 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 public class ValidateExcelRequest