예제 #1
0
    public void DeleteTask(Guid taskID)
    {
        var task = _context.Tasks.Where(b => b.Id.Equals(taskID)).Single();

        Console.WriteLine(task);
        _context.Remove(task);
    }
예제 #2
0
        public IActionResult TryDeleteItem(int itemID, UserDashboardViewModel model)
        {
            _toDoListContext.Remove(_toDoListContext.ToDoItems.Find(itemID));
            _toDoListContext.SaveChanges();

            model.ToDoItems = ConvertDALToBasic();

            return(View("UserDashboard", model));
        }
예제 #3
0
        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();
            }
        }
예제 #4
0
 public Task <bool> Delete(ToDoTask toDoTaskToDelete)
 {
     return(Task.Run(() =>
     {
         if (_toDoListContext != null)
         {
             _toDoListContext.Remove(toDoTaskToDelete);
             _toDoListContext.SaveChanges();
             return true;
         }
         else
         {
             return false;
         }
     }));
 }