Exemple #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SKU = await _context.SKUs.FirstOrDefaultAsync(m => m.SKUID == id);

            if (SKU == null)
            {
                return(NotFound());
            }
            PopulatePrincipalSL();
            PopulateUOMSL();
            PopulateBrandSL();
            PopulateVatSL();
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnDeleteDelete([FromBody] CicotiWebApp.Models.SKU obj)
        {
            if (obj != null && HttpContext.User.IsInRole("Admin"))
            {
                try
                {
                    _context.SKUs.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."));
            }
        }