public ActionResult Delete(long id, FormCollection collection) { bool success = false; try { long accountId = MTApp.CurrentRequestContext.CurrentAdministrator(MTApp).Id; ToDoItemRepository repository = new ToDoItemRepository(MTApp.CurrentRequestContext); ToDoItem item = repository.Find(id); if (item != null) { if (item.AccountId == accountId) { success = repository.Delete(id); } } } catch { } return(new JsonResult() { Data = MerchantTribe.Web.Json.ObjectToJson(new { result = success }) }); }
public async Task <bool> Handle(DeleteToDoItemCommand request, CancellationToken cancellationToken) { var toDoItem = await ToDoItemRepository.Get(request.Id); if (toDoItem == null) { throw new NotFoundException(request.Id, typeof(ToDoItem)); } await ToDoItemRepository.Delete(request.Id); return(true); }
public void RemoveToDoList(ToDoList deletedList) { ToDoListRepository toDoListRepository = new ToDoListRepository(); toDoListRepository.Delete(deletedList); //Items also will be deleted from related list. ToDoItemRepository toDoItemRepository = new ToDoItemRepository(); List <ToDoItem> toDoItems = GetItems(deletedList); foreach (ToDoItem item in toDoItems) { toDoItemRepository.Delete(item); } }
public void DeleteToDoItem(int id) { _toDoItemRepository.Delete(id); }
/// <summary> /// Find and remove a to-do item, from the repository, using the ID. /// </summary> /// <param name="id"></param> /// <returns>The To-do item that was removed. Returns null if the to-do ID could not be found</returns> public async Task <ToDoItemVm> RemoveToDoItem(int id) { var result = await _todoRepo.Delete(id); return(_mapper.Map <ToDoItemVm>(result)); }
public void RemoveToDoItem(ToDoItem deletedItem) { ToDoItemRepository toDoItemRepository = new ToDoItemRepository(); toDoItemRepository.Delete(deletedItem); }
public ActionResult Delete(long id, FormCollection collection) { bool success = false; try { long accountId = MTApp.CurrentRequestContext.CurrentAdministrator(MTApp).Id; ToDoItemRepository repository = new ToDoItemRepository(MTApp.CurrentRequestContext); ToDoItem item = repository.Find(id); if (item != null) { if (item.AccountId == accountId) { success = repository.Delete(id); } } } catch { } return new JsonResult() { Data = MerchantTribe.Web.Json.ObjectToJson(new { result = success }) }; }
public void DeleteItem(long id) { _toDoItemRepository.Delete(id); }
public async Task DeleteToDoItem() { int deleteResult = await _toDoItemRepository.Delete(1, 1); Assert.IsNotNull(deleteResult); }