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()); }
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.")); } }