public async Task <HttpResponseMessage> DeleteTodo(int id) { var todo = await _todosService.FetchProxyById(id); if (todo != null) { await _todosService.DeleteById(id); return(new HttpResponseMessage(HttpStatusCode.NoContent)); } return(Request.CreateResponse(HttpStatusCode.NotFound, new ErrorDtoResponse("Todo not Found"), GlobalConfiguration.Configuration.Formatters.JsonFormatter)); }
public IActionResult DeleteTodo(long id) { todoService.DeleteById(id); return(RedirectToAction(actionName: nameof(Index))); }