Beispiel #1
0
 public ActionResult AjaxAddEmployeeVoluntaryInsurance(VoluntaryInsuranceAddFormView insuranceaddFormView)
 {
     if (ModelState.IsValid)
     {
         VoluntaryInsuranceAddRequest request = new VoluntaryInsuranceAddRequest()
         {
             EmployeeId = insuranceaddFormView.VoluntaryEployeeId,
             DateOfIssue = insuranceaddFormView.VoluntaryDateOfIssue,
             InssuranceNo = insuranceaddFormView.VoluntaryInsuranceNo,
             AttachFile = insuranceaddFormView.VoluntaryAttachFile,
             Amount = insuranceaddFormView.VoluntaryAmount
         };
         VoluntaryInsuranceAddResponse response = insuranceService.AddVoluntaryInsurance(request);
         if (response.Success)
         {
             return Json(new { status = "Success", message = response.Message });
         }
         else
         {
             return Json(new { status = "Fail", message = response.Message });
         }
     }
     return Json(new { status = "Fail", message = "Dữ liệu nhập không hợp lệ" });
 }
Beispiel #2
0
 public VoluntaryInsuranceAddResponse AddVoluntaryInsurance(VoluntaryInsuranceAddRequest request)
 {
     VoluntaryInsuranceAddResponse response = new VoluntaryInsuranceAddResponse();
     Insurance insertedInsurance = new Insurance()
     {
         InsuranceNo = request.InssuranceNo,
         DateOfIssue = request.DateOfIssue,
         IsMandatory = false,
         Values = request.Amount,
         CreatedDate = DateTime.Now,
         UpdatedDate = DateTime.Now,
         EmployeeId = request.EmployeeId,
         AttachFile = request.AttachFile
     };
     try
     {
         insuranceRepository.Add(insertedInsurance);
         SaveInsurance();
         response.Success = true;
         response.Message = insertedInsurance.Id.ToString();
     }
     catch (Exception ex)
     {
         response.Success = false;
         response.Message = ex.Message;
     }
     return response;
 }