public ActionResult Approve(FormCollection collection) { int voucherId = Convert.ToInt32(collection["VoucherIdToApprove"]); Voucher aVoucher = _iAccountsManager.GetVoucherByVoucherId(voucherId); var anUser = (ViewUser)Session["user"]; var voucherDetails = _iAccountsManager.GetVoucherDetailsByVoucherId(voucherId).ToList(); bool result = _iAccountsManager.ApproveVoucher(aVoucher, voucherDetails, anUser.UserId); return(result ? RedirectToAction("Vouchers") : RedirectToAction("VoucherDetails", "Account", aVoucher)); }
public ActionResult Approve(FormCollection collection) { try { int voucherId = Convert.ToInt32(collection["VoucherIdToApprove"]); Voucher aVoucher = _iAccountsManager.GetVoucherByVoucherId(voucherId); var anUser = (ViewUser)Session["user"]; var voucherDetails = _iAccountsManager.GetVoucherDetailsByVoucherId(voucherId).ToList(); bool result = _iAccountsManager.ApproveVoucher(aVoucher, voucherDetails, anUser.UserId); return(result ? RedirectToAction("Vouchers") : RedirectToAction("VoucherDetails", "Voucher", aVoucher)); } catch (Exception exception) { Log.WriteErrorLog(exception); return(PartialView("_ErrorPartial", exception)); } }