public void SaveCaseInsurancePaymentVM(CaseInsurancePaymentVM n) { var m = Transform(n); if (m.Id == 0) { _context.CaseInsurancePayments.Add(m); } _context.SaveChanges(); n.Id = m.Id; }
public CaseInsurancePaymentVM Transform(CaseInsurancePayment n) { var r = new CaseInsurancePaymentVM { InsurancePaymentAmount = n.Amount, PaymentCaseInsuranceId = n.CaseInsuranceId }; if (n.CaseInsurance != null) { r.PaymentCaseInsuranceName = n.CaseInsurance.Insurance.Name; } r.Description = n.Description; r.Id = n.Id; r.PaymentDate = n.PaymentDate; return(r); }
public CaseInsurancePayment Transform(CaseInsurancePaymentVM n) { CaseInsurancePayment r; if (n.Id > 0) { r = _context.CaseInsurancePayments.Where(p => p.Id == n.Id).FirstOrDefault(); } else { r = _context.CaseInsurancePayments.Create(); } r.Amount = n.InsurancePaymentAmount; r.CaseInsuranceId = n.PaymentCaseInsuranceId; r.Description = n.Description; r.PaymentDate = n.PaymentDate; return(r); }
public ActionResult InsurancePaymentSave(CaseInsurancePaymentVM m) { _service.SaveCaseInsurancePaymentVM(m); return(InsurancePaymentForm(m.PaymentCaseInsuranceId, m.Id)); }