public async Task UpdateAsync(T item) { using (var _ctx = new FoodLogContext()) { _ctx.Entry(item).State = EntityState.Modified; await _ctx.SaveChangesAsync(); } }
public async Task CreateAsync(T item) { using (var _ctx = new FoodLogContext()) { await _context.Set <T>().AddAsync(item); await _context.SaveChangesAsync(); } }