コード例 #1
0
 public async Task UpdateAsync(T item)
 {
     using (var _ctx = new FoodLogContext())
     {
         _ctx.Entry(item).State = EntityState.Modified;
         await _ctx.SaveChangesAsync();
     }
 }
コード例 #2
0
        public async Task CreateAsync(T item)
        {
            using (var _ctx = new FoodLogContext())
            {
                await _context.Set <T>().AddAsync(item);

                await _context.SaveChangesAsync();
            }
        }