public async Task CreateAsync(T item) { using (var _ctx = new FoodLogContext()) { await _context.Set <T>().AddAsync(item); await _context.SaveChangesAsync(); } }
public void Create(T item) { using (var _ctx = new FoodLogContext()) { _ctx.Set <T>().Add(item); _ctx.SaveChanges(); } }