public async Task <IActionResult> OnGetAsync(int?ID) { AccAmtPrinciple = new Models.ActCostAccountAmtPrinciple { }; if (ID != null) { AccAmtPrinciple = await _context.ActCostAccountAmtPrinciple .Include(a => a.ActCostAccount) .SingleOrDefaultAsync(m => m.ActCostAccountAmtPrincipleID == ID); } PopulatePeriodSL(); PopulatePrincipleSL(); return(Page()); }
public async Task <IActionResult> OnDeleteDelete([FromBody] ActCostAccountAmtPrinciple obj) { if (obj != null && HttpContext.User.IsInRole("Admin")) { try { _context.ActCostAccountAmtPrinciple.Remove(obj); await _context.SaveChangesAsync(); return(new JsonResult("Other Income Removed successfully")); } catch (DbUpdateException d) { return(new JsonResult("Other Income Amount not removed." + d.InnerException.Message)); } } else { return(new JsonResult("Other Income not removed.")); } }