Пример #1
0
        public async Task <Meal> UpdateAsync(Meal item)
        {
            using var db = new EfMealsDataModel(_options);
            var entityEntry = db.Meals.Update(item);
            await db.SaveChangesAsync().ConfigureAwait(true);

            return(entityEntry.Entity);
        }
Пример #2
0
        public async Task DeleteAsync(uint id)
        {
            using var db = new EfMealsDataModel(_options);
            var item = await db.Meals.FindAsync(id);

            db.Meals.Remove(item);
            await db.SaveChangesAsync().ConfigureAwait(true);
        }
Пример #3
0
 public async Task <Meal> FindAsync(uint id)
 {
     using var db = new EfMealsDataModel(_options);
     return(await db.Meals.FindAsync(id).ConfigureAwait(true));
 }
Пример #4
0
 public async Task <ICollection <Meal> > FindAllAsync()
 {
     using var db = new EfMealsDataModel(_options);
     return(await db.Meals.ToListAsync().ConfigureAwait(true));
 }