Exemple #1
0
        public async Task <IActionResult> OnGetAsync(int?BrandID)
        {
            Brand = new Models.Brand {
            };


            if (BrandID != null)
            {
                Brand = await _context.Brand
                        .SingleOrDefaultAsync(m => m.BrandID == BrandID);
            }
            PopulatePrincipleSL();
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnDeleteDelete([FromBody] CicotiWebApp.Models.Brand obj)
        {
            if (obj != null && HttpContext.User.IsInRole("Admin"))
            {
                try
                {
                    _context.Brand.Remove(obj);
                    await _context.SaveChangesAsync();

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