public JsonResult Save(PaymentMethodViewModel model) { int saveIndex = 0; PaymentMethod paymentMethod = new PaymentMethod(); paymentMethod.PaymentMethodId = model.PaymentMethodId; paymentMethod.ServiceId = model.ServiceId; paymentMethod.PatientId = model.PatientId; paymentMethod.Charge = model.Charge; paymentMethod.DiscountAmount = model.DiscountAmount; paymentMethod.Paid = model.Paid; paymentMethod.Date = model.Date; paymentMethod.PaymentType = model.PaymentType; paymentMethod.CreatedDate = model.CreatedDate; paymentMethod.LastPaidDate = model.LastPaidDate; paymentMethod.TotalCharge = paymentMethod.Charge - paymentMethod.DiscountAmount; paymentMethod.Due = paymentMethod.TotalCharge - paymentMethod.Paid; saveIndex = model.PaymentMethodId == 0 ? PaymentMethodManager.Save(paymentMethod) : PaymentMethodManager.Edit(paymentMethod); return(Reload(saveIndex)); }