public async Task <Operation> AddAsync(Operation operation) { _db.Operations.Add(operation); await _db.SaveChangesAsync(); return(operation); }
public async Task <Card> EditAsync(Card card) { var current = await _db.Cards.FirstOrDefaultAsync(_card => _card.Id == card.Id); if (null == current) { throw new InvalidOperationException("Card id not found"); } else { _db.Entry(current).CurrentValues.SetValues(card); } await _db.SaveChangesAsync(); return(card); }