public ActionResult ChangeAmount(ChangeAmountModel model) { if ((model.AccountTransactionType == AccountTransactionType.Withdrawn || model.AccountTransactionType == AccountTransactionType.Reduction) && model.NewAmount > model.CurrentAmount) { return(Json(new { IsValid = false, ReferenceNumber = model.ReferenceNumber, Amount = model.NewAmount, ErrorMessage = "New Amount cannot be more than the Current Amount." })); } model.TerminalName = "IMS"; model.ApprovedDate = DateTime.Now; model.ReferenceTransactionType = ReferenceTransactionType.Representation; try { var fineService = new FineService(AuthenticatedUser.SessionToken); fineService.ChangeAmount(model); PaymentSummary paymentSummary = Session["PaymentSummary"] as PaymentSummary; paymentSummary.Fines.Single(f => f.ReferenceNumber == model.ReferenceNumber).OutstandingAmount = model.NewAmount; Session["PaymentSummary"] = paymentSummary; return(Json(new { IsValid = true, ReferenceNumber = model.ReferenceNumber, Amount = model.NewAmount, ErrorMessage = string.Empty })); } catch (GatewayException ex) { return(Json(new { IsValid = false, ReferenceNumber = model.ReferenceNumber, Amount = model.NewAmount, ErrorMessage = ex.Message })); } }