public IActionResult Remove(int id) { Thing thing = _thingsRepository.GetSingle(id); if (thing == null) { return(NotFound()); } _thingsRepository.Delete(id); return(NoContent()); }
public IActionResult OnPost(int thingId) { var deletedThing = thingsRepository.Delete(thingId); thingsRepository.SaveChanges(); if (deletedThing == null) { return(RedirectToPage("./NotFound")); } TempData["Message"] = $"You deleted {Thing.Name}."; return(RedirectToPage("./List")); }