public ActionResult EditAccount(int id, AccountFilterModel filter, FormCollection collection) { var account = AccountServices.GetAccount(id); try { UpdateModel(account); AccountServices.UpdateAccount(account); return RedirectToAction("AccountListing", filter.GenerateAccountListingRoute()); } catch (Exception ex) { // Invalid - redisplay with errors Logger.Error(ex.ToString()); ModelState.AddModelError(String.Empty, Constants.ServerError); var model = new AccountDetailModel() { Action = "EditAccount", Account = account, Filter = filter }; ViewBag.AccountTypes = AccountTypeServices.GetAccountTypes(false, account.AccountTypeId); ViewBag.StateCodes = LookupServices.GetStateOptions(account.StateCode); return View("AccountDetail", model); } }
public ActionResult EditAccount(int id, AccountFilterModel filter) { var account = AccountServices.GetAccount(id); var model = new AccountDetailModel() { Action = "EditAccount", Account = account, Filter = filter, }; ViewBag.AccountTypes = AccountTypeServices.GetAccountTypes(false, account.AccountTypeId); ViewBag.StateCodes = LookupServices.GetStateOptions(account.StateCode); return View("AccountDetail", model); }
public ActionResult NewAccount(AccountFilterModel filter) { var model = new AccountDetailModel() { Action = "NewAccount", Account = new AccountModel(), Filter = filter, }; ViewBag.AccountTypes = AccountTypeServices.GetAccountTypes(false); ViewBag.StateCodes = LookupServices.GetStateOptions("TN"); return View("AccountDetail", model); }