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

            Price = await _context.Prices.Include(s => s.SKU).FirstOrDefaultAsync(m => m.PriceID == id);

            ////if (SkuUomLink == null)
            ////{
            ////    return NotFound();
            ////}
            PopulateRegionSL();
            PopulateBranchSL();
            PopulatePriceTypeSL();
            return(Page());
        }
예제 #2
0
        public async Task <IActionResult> OnDeleteDelete([FromBody] CicotiWebApp.Models.Price obj)
        {
            if (obj != null && HttpContext.User.IsInRole("Admin"))
            {
                try
                {
                    _context.Prices.Remove(obj);
                    await _context.SaveChangesAsync();

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