public IQueryable DeleteItem([FromBody] TodoItem item) { var toBeDeleted = _context.TodoItems.FirstOrDefault(i => i.Id == item.Id); if (toBeDeleted != null) { _context.Remove(toBeDeleted); _context.SaveChanges(); } return(_context.TodoItems.Where(i => i.Category == item.Category)); }
public async Task Delete(int id) { var entity = await this.GetById(id); if (entity != null) { _context.Remove(entity); await _context.SaveChangesAsync(); } }