public async Task <ActionResult> CreateAccount(FinAccountViewModel model) { try { if (ModelState.IsValid) { var resp = await FinAccountModel.CreateAccount(model, User.Identity.Name); if (resp.IsSuccess) { ViewData["SuccessAdd"] = $"تم إضافة الحساب {model.Code} - {model.NameAr} بنجاح"; model = null; } else { ModelState.AddModelError("", resp.Message); } } } catch (Exception ex) { } ViewData["CurrenciesList"] = await FinAccountModel.GetCurrenciesList(); ViewData["AcctsList"] = await FinAccountModel.GetAccountsList(); return(View(model)); }
public async Task <ActionResult> CreateAccount() { ViewData["AcctsList"] = await FinAccountModel.GetAccountsList(); ViewData["CurrenciesList"] = await FinAccountModel.GetCurrenciesList(); return(View()); }
public async Task <ActionResult> AccountData(int id) { var model = await FinAccountModel.GetAccount(id); ViewData["AcctsList"] = await FinAccountModel.GetAccountsList(); ViewData["CurrenciesList"] = await FinAccountModel.GetCurrenciesList(); return(View(model)); }
public async Task <ActionResult> DeleteConfirmed(int id) { var result = await FinAccountModel.DeleteAccount(id, User.Identity.Name); if (result.IsSuccess) { return(RedirectToAction("Index")); } else { ViewData["ErrorMsg"] = result.Message; var finAccountViewModel = await FinAccountModel.GetAccount(id); return(View(finAccountViewModel)); } }
public async Task <ActionResult> DeleteAccount(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var finAccountViewModel = await FinAccountModel.GetAccount(id.Value); if (finAccountViewModel == null) { return(HttpNotFound()); } return(View(finAccountViewModel)); }
public async Task <ActionResult> EditAccount(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var model = await FinAccountModel.GetAccount(id.Value); if (model == null) { return(HttpNotFound()); } model.SelectedCurrencies = model.Currencies.Select(e => e.CurrencyID).ToList(); ViewData["AcctsList"] = await FinAccountModel.GetAccountsList(); ViewData["CurrenciesList"] = await FinAccountModel.GetCurrenciesList(); return(View(model)); }
public async Task <FinAccountViewModel> GetAccount(int AccountID) { return(await FinAccountModel.GetAccount(AccountID)); }
// GET api/values public async Task <List <FinAccountViewModel> > GetAccountsList(string searchText) { return(await FinAccountModel.GetAccountsList(searchText)); }
// GET: FinAccount public async Task <ActionResult> Index(string searchText) { var list = await FinAccountModel.GetAccountsList(searchText); return(View(list)); }