Edit Employee Insurance Validation
This commit is contained in:
@@ -271,7 +271,8 @@ public class IndexModel : PageModel
|
||||
|
||||
public JsonResult OnPostEdit(EditEmployee command)
|
||||
{
|
||||
var childrenEdit = 0;
|
||||
var op = new OperationResult();
|
||||
var childrenEdit = 0;
|
||||
var children = 0;
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
@@ -283,15 +284,29 @@ public class IndexModel : PageModel
|
||||
if (command.EditEmployeChildrenList != null)
|
||||
childrenEdit = command.EditEmployeChildrenList.Count(x => x.DateOfBirth != null);
|
||||
|
||||
//if (children > 0)
|
||||
//{
|
||||
// var oldChildrenNumber = Convert.ToInt32(command.NumberOfChildren);
|
||||
// var sumChildren = oldChildrenNumber + children;
|
||||
// command.NumberOfChildren = sumChildren.ToString();
|
||||
//}
|
||||
//if (children > 0)
|
||||
//{
|
||||
// var oldChildrenNumber = Convert.ToInt32(command.NumberOfChildren);
|
||||
// var sumChildren = oldChildrenNumber + children;
|
||||
// command.NumberOfChildren = sumChildren.ToString();
|
||||
//}
|
||||
if (string.IsNullOrWhiteSpace(command.InsuranceHistoryByYear) || string.IsNullOrWhiteSpace(command.InsuranceHistoryByMonth))
|
||||
return new JsonResult(op.Failed("لطفا سابقه بیمه را مشخص نمایید"));
|
||||
if (command.InsuranceHistoryByYear != "0")
|
||||
{
|
||||
var insuranceYear = command.InsuranceHistoryByYear.ExtractIntNumbers();
|
||||
if (insuranceYear == 0)
|
||||
return new JsonResult(op.Failed("لطفا سال را به عدد وارد کنید"));
|
||||
}
|
||||
|
||||
if (command.InsuranceHistoryByMonth != "0")
|
||||
{
|
||||
var insuranceMonth = command.InsuranceHistoryByMonth.ExtractIntNumbers();
|
||||
if (insuranceMonth == 0)
|
||||
return new JsonResult(op.Failed("لطفا ماه را به عدد وارد کنید"));
|
||||
}
|
||||
|
||||
var result = _employeeApplication.Edit(command);
|
||||
var result = _employeeApplication.Edit(command);
|
||||
Thread.Sleep(1000);
|
||||
if (result.IsSuccedded)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user