//[ValidateAntiForgeryToken] public async Task <IActionResult> DeleteConfirmed(int id) { var entity = await _todoRepository.GetByIdAsync(id); await _todoRepository.DeleteAsync(entity); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DeleteConfirmed(int id, string versionString) { var version = Convert.FromBase64String(versionString); var count = await _Repository.DeleteAsync(id, version); if (count != 1) { return(NotFound()); } return(RedirectToAction(nameof(Index))); }
public async Task DeleteAsync(DeleteTodo command) { var todo = await _todoRepository.GetAsync(command.TodoId); if (todo is null) { throw new TodoNotFoundException(command.TodoId); } await _todoRepository.DeleteAsync(todo); }
public async Task <IActionResult> Delete(int id) { var todo = await _todoRepository.GetByIdAsync(id); if (todo == null) { return(NotFound(new ApiResponse(404, $"Todo not found with id {id}"))); } await _todoRepository.DeleteAsync(id); return(Ok(new ApiOkResponse($"Todo deleted with id {id}"))); }
public async Task <bool?> DeleteTodo(Guid id) { TodoEntity existingTodoEntity = await _todoRepository.GetByIdAsync(id); if (existingTodoEntity == null) { return(null); } await _todoRepository.DeleteAsync(existingTodoEntity); return(true); }
public async Task <IActionResult> DeleteTodoItem(long id) { var todoItem = await _repository.FindAsync(id); if (todoItem == null) { return(NotFound()); } await _repository.DeleteAsync(todoItem); return(NoContent()); }
public async Task <IActionResult> Delete(int id) { try { var result = await _repository.DeleteAsync(id); return(Ok(result)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to delete task!")); } }
public async Task TestAddDelete() { var item = new TodoItemModel() { IsCompleted = false, ItemName = "Test Item" }; var Id = await _repository.CreateAsync(item); var newItem = await _repository.GetAsync(Id); var deletedStatus = await _repository.DeleteAsync(Id); var deleted = await _repository.GetAsync(Id); Assert.AreEqual(Id, newItem.Id); Assert.IsNull(deleted); }
public async Task <ActionResult> DeleteTodo(int id) { var user = await accountManager.GetUser(); var todo = await todoRepository.GetAsync(id); var todoList = todo.TodoList; if (todo.Creator.Id != user.Id && todoList.Members.ToList().Exists(x => x.UserId == user.Id)) { return(BadRequest("user not a creator , not an admin")); } if (await todoRepository.DeleteAsync(todo)) { return(new OkObjectResult("todo deleted")); } return(BadRequest()); }
public async Task <TodoItem> DeleteAsync(long id) { return(await _todoRepository.DeleteAsync(id)); }
/// <inheritdoc/> public async Task DeleteTodo(Guid id) { TodoEntity existingTodoEntity = await _todoRepository.GetByIdAsync(id); await _todoRepository.DeleteAsync(existingTodoEntity); }
public async Task <bool?> DeleteAsync(long id) { return(await _store.DeleteAsync(id)); }
public async Task <IActionResult> DeleteAsync(Guid id) { var deletedTodo = await _todoService.DeleteAsync(id); return(Ok(deletedTodo)); }
public Task <bool> DeleteAsync(int id) { return(_todoRepository.DeleteAsync(id)); }
public async Task <IActionResult> Delete([Required] int id) { await _todoRepository.DeleteAsync(id); return(Ok()); }
public async Task <bool> DelTodoAsync(Guid id) { return(await _todoRepository.DeleteAsync(id)); }
public async Task <IActionResult> Delete(int id) { await _todoRepository.DeleteAsync(id); return(Ok(new ApiOkResponse($"Todo deleted with id {id}"))); }
public async Task <TodoItemDto> DeleteAsync(Todoitem toDoItem) { return(Mapper.Map <TodoItemDto>(await _dorepo.DeleteAsync(toDoItem))); }
public async Task <IActionResult> DeleteOk(int id) { var result = await _repository.DeleteAsync(id); return(RedirectToAction(nameof(Index))); }
public async Task DeleteTodoAsync(long todoId, string userid) { await _todoRepository.DeleteAsync(todoId); await _todoRepository.Save(); }
public async Task <ActionResult> DeleteTodoAsync(int id) { await _repository.DeleteAsync(id); return(Ok()); }
public async Task DeleteTodoAsync(Guid id) { await _todoRepository.DeleteAsync(id); }