public bool Delete(int id) { var dbEntity = _toDoListRepository.Delete(id); _unitOfWork.Commit(); return(dbEntity); }
public async Task <IActionResult> DeleteToDoListItem(int userId, int id) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var itemToDelete = await _repo.GetItem(id); if (itemToDelete == null) { return(NotFound()); } if (userId != itemToDelete.UserId) { return(Unauthorized()); } _repo.Delete(itemToDelete); if (await _repo.SaveAll()) { return(Ok()); } return(BadRequest("Failed to delete the list item")); }
public ActionResult DeleteConfirmed(int id) { todolistRepository.Delete(id); todolistRepository.Save(); return(RedirectToAction("Index")); }
public int Delete(int Id) { if (string.IsNullOrWhiteSpace(Id.ToString())) { return(result); } else { return(_toDoListRepository.Delete(Id)); } }
public IActionResult DeleteToDoList(int toDoListID) { try { _toDoListRepository.Delete(toDoListID); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult Deletar([FromBody] ToDoList todolist) { try { /// produto da requisicao deve tar a propriedade do Id > 0 para conseguir remover. _todolistRepository.Delete(todolist); return(Json(_todolistRepository.GetAll())); } catch (Exception ex) { return(BadRequest(ex.ToString())); } }
public async Task <IActionResult> DeleteToDoList(string id, string sfObject) { var response = await _toDoListRepo.Delete(id, sfObject); if (response) { return(RedirectToAction("Index", "Home")); } else { return(View()); } }
public ActionResult Delete(ToDoList model) { try { ToDoList _newTask = new ToDoList(); _newTask = toDoListRepository.Details(model.ToDoListID); toDoListRepository.Delete(_newTask); return(RedirectToAction("index")); } catch { return(View()); } }
public ActionResult Delete(int id, todolist items) { try { // TODO: Add delete logic here toDoListRepository.Delete(id); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public void DeleteTest() { ToDoLists.Lists.Add(1, new List <ToDoList>()); ToDoList list = new ToDoList { UserID = 1, Title = "Test List" }; var insert = _toDoListRepository.Create(list); _toDoListRepository.Delete(insert.ID); Assert.AreEqual(0, ToDoLists.Lists[1].Count); }
public async Task DeleteTask(DeleteToDoTask command) { var existingTask = await _toDoRepository.GetById(command.TaskId); if (existingTask == null) { throw new Exception("can't update task - id not found"); } if (existingTask.UserId != command.UserId) { throw new Exception("can't update task - wrong user"); } await _toDoRepository.Delete(command.TaskId); }
public int Delete(int Id) { return(_todolistRepository.Delete(Id)); //throw new NotImplementedException(); }
public int Delete(int id) { return(_toDoListRepository.Delete(id)); }
public void Delete(ToDoList task) { _ToDoListRepository.Delete(task); Save(); }