public IActionResult DeleteTodo(int id, string searchString, bool?isCompleted, int page, int pageSize) { try { todoItemService.DeleteTodoItem(id); return(Index(searchString, isCompleted, page, pageSize)); } catch (Exception ex) { _logger.LogError(ex.Message); return(Error()); } }
public void Delete(int id) { if (!User.Identity.IsAuthenticated) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Доступ разрешен только для авторизованным пользователям")); } var item = _todoItemService.GetTodoItemById(id); if (item == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Не удалось найти указанный элемент")); } if (User.Identity.GetUserId() != _todoListService.GetTodoListById(item.TodoListEntityId).ApplicationUserEntityId) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.Forbidden, "Доступ к ресурсу запрещен")); } _todoItemService.DeleteTodoItem(item); }
public async Task <IActionResult> DeleteTodoItem(long id) { await _todoItemService.DeleteTodoItem(id); return(NoContent()); }
public async Task <SingleResponseModel <bool> > DeleteTodoItem(int id) { return(await _todoItemService.DeleteTodoItem(id)); }
public async Task DeleteTodoItem(long id) { await _todoItemService.DeleteTodoItem(id); Accepted(); }
public async Task <ActionResult <TodoItem> > DeleteTodoItem(long id) { var response = await _service.DeleteTodoItem(id); return(response); }
public async Task DeleteTodoItem(int todoItemId) { await _todoItemService.DeleteTodoItem(todoItemId); await UpdateTodoItems(); }