public ActionResult Edit(string id, MoneyAccountDetailView moneyAccountDetailView) { moneyAccountDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccount_Update"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountDetailView)); } #endregion if (ModelState.IsValid) { try { EditMoneyAccountRequestOld request = new EditMoneyAccountRequestOld(); request.ID = Guid.Parse(id); request.ModifiedEmployeeID = GetEmployee().ID; request.AccountName = moneyAccountDetailView.MoneyAccountView.AccountName; request.BAccountInfo = moneyAccountDetailView.MoneyAccountView.BAccountInfo; request.BAccountNumber = moneyAccountDetailView.MoneyAccountView.BAccountNumber; request.IsBankAccount = moneyAccountDetailView.MoneyAccountView.IsBankAccount; request.Pay = moneyAccountDetailView.MoneyAccountView.Pay; request.Receipt = moneyAccountDetailView.MoneyAccountView.Receipt; request.RowVersion = moneyAccountDetailView.MoneyAccountView.RowVersion; GeneralResponse response = this._moneyAccountService.EditMoneyAccount(request); if (response.success) { return(RedirectToAction("Index")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(moneyAccountDetailView)); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(moneyAccountDetailView)); } } return(View(moneyAccountDetailView)); }
public ActionResult Create() { MoneyAccountDetailView moneyAccountDetailView = new MoneyAccountDetailView(); moneyAccountDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccount_Insert"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountDetailView)); } #endregion return(View(moneyAccountDetailView)); }
public ActionResult Delete(string id) { MoneyAccountDetailView moneyAccountDetailView = new MoneyAccountDetailView(); moneyAccountDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccount_Delete"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountDetailView)); } #endregion moneyAccountDetailView.MoneyAccountView = this.GetMoneyAccountView(id); return(View(moneyAccountDetailView)); }
public ActionResult Delete(string id, FormCollection collection) { MoneyAccountDetailView moneyAccountDetailView = new MoneyAccountDetailView(); moneyAccountDetailView.EmployeeView = GetEmployee(); #region Check Access bool hasPermission = GetEmployee().IsGuaranteed("MoneyAccount_Delete"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(moneyAccountDetailView)); } #endregion moneyAccountDetailView.MoneyAccountView = this.GetMoneyAccountView(id); DeleteRequest request = new DeleteRequest() { ID = Guid.Parse(id) }; GeneralResponse response = this._moneyAccountService.DeleteMoneyAccount(request); if (response.success) { return(RedirectToAction("Index")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(moneyAccountDetailView)); } }