public async Task <IActionResult> OnGetAsync(int?id) { //if (id == null) //{ // return NotFound(); //} SkuUomLink = await _context.SkuUomLinks.Include(s => s.SKU).FirstOrDefaultAsync(m => m.SkuUomLinkID == id); ////if (SkuUomLink == null) ////{ //// return NotFound(); ////} PopulatePrincipalSL(); PopulateFromUOMSL(); PopulateToUOMSL(); PopulateBrandSL(); return(Page()); }
public async Task <IActionResult> OnDeleteDelete([FromBody] CicotiWebApp.Models.SkuUomLink obj) { if (obj != null && HttpContext.User.IsInRole("Admin")) { try { _context.SkuUomLinks.Remove(obj); await _context.SaveChangesAsync(); return(new JsonResult("SKU removed successfully")); } catch (DbUpdateException d) { return(new JsonResult("SKU not removed." + d.InnerException.Message)); } } else { return(new JsonResult("SKU not removed.")); } }