Files
Backend-Api/ServiceHost/Pages/Register/Index.cshtml.cs
2025-04-23 23:22:26 +03:30

132 lines
4.7 KiB
C#

using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Mono.TextTemplating;
using PersianTools.Core;
using System.Net;
namespace ServiceHost.Pages.register
{
public class IndexModel : PageModel
{
private readonly ITemporaryClientRegistrationApplication _temporaryClientRegistrationApplication;
public IndexModel(ITemporaryClientRegistrationApplication temporaryClientRegistrationApplication)
{
_temporaryClientRegistrationApplication = temporaryClientRegistrationApplication;
}
public void OnGet()
{
}
public async Task<IActionResult> OnPostCreateContractingPartyTemp(string nationalCode, string birthDate, string mobile)
{
var result = await _temporaryClientRegistrationApplication.CreateContractingPartyTemp(nationalCode, birthDate, mobile);
return new JsonResult(new
{
success = result.IsSuccedded,
data = result.Data,
message = result.Message,
});
}
public async Task<IActionResult> OnPostUpdateAddress(long id, string state, string city, string address)
{
var result = await _temporaryClientRegistrationApplication.UpdateAddress(id, state, city, address);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message,
});
}
public async Task<IActionResult> OnPostCreateOrUpdateWorkshopTemp(List<WorkshopTempViewModel> command, long contractingPartyTempId)
{
var result = await _temporaryClientRegistrationApplication.CreateOrUpdateWorkshopTemp(command, contractingPartyTempId);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message,
});
}
public IActionResult OnGetInstitutionPlanForWorkshop(WorkshopTempViewModel workshopTemp)
{
var result = _temporaryClientRegistrationApplication.GetInstitutionPlanForWorkshop(workshopTemp);
return new JsonResult(new
{
data = result,
});
}
public async Task<IActionResult> OnGetTotalPaymentAndWorkshopList(long contractingPartyTempId, string periodModel = "12", string paymentModel = "OneTime")
{
var result = await _temporaryClientRegistrationApplication.GetTotalPaymentAndWorkshopList(contractingPartyTempId, periodModel, paymentModel);
return new JsonResult(new
{
data = result,
});
}
public async Task<IActionResult> OnPostCreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel, double totalPayment, double valueAddedTax)
{
var result = await _temporaryClientRegistrationApplication.CreateOrUpdateInstitutionContractTemp(contractingPartyTempId, periodModel, paymentModel, totalPayment, valueAddedTax);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
public async Task<IActionResult> OnGetWorkshopTemp(long contractingPartyId)
{
var result = await _temporaryClientRegistrationApplication.GetWorkshopTemp(contractingPartyId);
return new JsonResult(new
{
data = result,
});
}
public async Task<IActionResult> OnPostPayOffCompleted(long contractingPartyId)
{
var result = await _temporaryClientRegistrationApplication.PayOffCompleted(contractingPartyId);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
public async Task<IActionResult> OnPostReceivedCodeFromServer(long contractingPartyId)
{
var result = await _temporaryClientRegistrationApplication.ReceivedCodeFromServer(contractingPartyId);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
public async Task<IActionResult> OnPostCheckVerifyCodeIsTrue(long contractingPartyTempId, string verifyCode)
{
var result = await _temporaryClientRegistrationApplication.CheckVerifyCodeIsTrue(contractingPartyTempId, verifyCode);
return new JsonResult(new
{
success = result.IsSuccedded,
message = result.Message
});
}
}
}