Пример #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Make = await _context.Make.FirstOrDefaultAsync(m => m.MakeID == id);

            if (Make == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnDeleteDelete([FromBody] CicotiWebApp.Models.Make obj)
        {
            if (obj != null && HttpContext.User.IsInRole("Admin"))
            {
                try
                {
                    _context.Make.Remove(obj);
                    await _context.SaveChangesAsync();

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