public JsonResult CancelVatAmount(FormCollection collection) { SuccessErrorModel aModel = new SuccessErrorModel(); try { int vatId = Convert.ToInt32(collection["VatIdToCancel"]); var vat = _iVatManager.GetAllPendingVats().ToList().Find(n => n.VatId == vatId); var anUser = (ViewUser)Session["user"]; vat.CancelByUserId = anUser.UserId; bool result = _iAccountsManager.CancelVat(vat); aModel.Message = result ? "<p class='text-green'>Cancelled</p>" : "<p class='text-danger'>Failed to Approve!!</p>"; } catch (Exception e) { if (e.InnerException != null) { aModel.Message = "<p style='color:red'>" + e.InnerException.Message + "</p>"; } Log.WriteErrorLog(e); } return(Json(aModel, JsonRequestBehavior.AllowGet)); }