public void DeleteTask(Guid taskID) { var task = _context.Tasks.Where(b => b.Id.Equals(taskID)).Single(); Console.WriteLine(task); _context.Remove(task); }
public IActionResult TryDeleteItem(int itemID, UserDashboardViewModel model) { _toDoListContext.Remove(_toDoListContext.ToDoItems.Find(itemID)); _toDoListContext.SaveChanges(); model.ToDoItems = ConvertDALToBasic(); return(View("UserDashboard", model)); }
public async Task DeleteToDo(int id) { var item = await _context.ToDoLists.FirstOrDefaultAsync(x => x.Id == id); if (item != null) { _context.Remove(item); await _context.SaveChangesAsync(); } }
public Task <bool> Delete(ToDoTask toDoTaskToDelete) { return(Task.Run(() => { if (_toDoListContext != null) { _toDoListContext.Remove(toDoTaskToDelete); _toDoListContext.SaveChanges(); return true; } else { return false; } })); }