コード例 #1
0
        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));
        }
コード例 #2
0
        public async Task <ActionResult> CreateAccount()
        {
            ViewData["AcctsList"] = await FinAccountModel.GetAccountsList();

            ViewData["CurrenciesList"] = await FinAccountModel.GetCurrenciesList();

            return(View());
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
 public async Task <FinAccountViewModel> GetAccount(int AccountID)
 {
     return(await FinAccountModel.GetAccount(AccountID));
 }
コード例 #8
0
 // GET api/values
 public async Task <List <FinAccountViewModel> > GetAccountsList(string searchText)
 {
     return(await FinAccountModel.GetAccountsList(searchText));
 }
コード例 #9
0
        // GET: FinAccount
        public async Task <ActionResult> Index(string searchText)
        {
            var list = await FinAccountModel.GetAccountsList(searchText);

            return(View(list));
        }