public async Task <TodoEntity> UpdateAsync(TodoEntity entity) { EntityEntry <TodoEntity> updated = _dbSet.Update(entity); await _dbContext.SaveChangesAsync(); return(updated.Entity); }
public async Task <TodoEntity> AddAsync(TodoEntity entity) { EntityEntry <TodoEntity> added = await _dbSet.AddAsync(entity); await _dbContext.SaveChangesAsync(); return(added.Entity); }
public async Task <TodoEntity> RemoveAsync(long id) { TodoEntity user = await GetByIdAsync(id); if (user == null) { throw new ArgumentNullException(nameof(id), "User not found."); } _dbSet.Remove(user); await _dbContext.SaveChangesAsync(); return(user); }