public IActionResult DeleteTodoItemModel(int id) { if (!ModelState.IsValid) { return(HttpBadRequest(ModelState)); } var todoItemModel = _todoItemsService.Get(id); if (!TodoItemModelExists(id)) { return(HttpNotFound()); } _todoItemsService.Delete(id); return(Ok(todoItemModel)); }
public async Task <ActionResult <TodoItem> > DeleteTodoItem(long id) { if (id == 0) { return(BadRequest("Id must not be 0!")); } try { await _todoItemsService.Delete(id); return(NoContent()); } catch (Exception ex) { return(StatusCode(599, ex.Message)); } }
public IActionResult DeleteConfirmed(int id) { _todoItemsService.Delete(id); return(RedirectToAction("Index")); }
public async Task Delete(int id) { await _todoItemsService.Delete(id); }