Пример #1
0
        public async Task <IActionResult> OnGetAsync(int?AccountID)
        {
            Account = new ActCostAccount {
            };


            if (AccountID != null)
            {
                Account = await _context.ActCostAccount
                          .SingleOrDefaultAsync(m => m.ActCostAccountID == AccountID);
            }
            PopulateCostDriverSL();
            PopulateBranchSL();
            PopulateCategorySL();
            PopulateSubCategorySL();
            PopulateCostAllocationSL();
            PopulateAccountTypeSL();
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnDeleteDelete([FromBody] ActCostAccount obj)
        {
            if (obj != null && HttpContext.User.IsInRole("Admin"))
            {
                try
                {
                    _context.ActCostAccount.Remove(obj);
                    await _context.SaveChangesAsync();

                    return(new JsonResult("Account removed successfully"));
                }
                catch (DbUpdateException d)
                {
                    return(new JsonResult("Account not removed." + d.InnerException.Message));
                }
            }
            else
            {
                return(new JsonResult("Account not removed."));
            }
        }