Exemplo n.º 1
0
 public static async Task AddItemCategory(this AppDbContext db, ItemCategory itemCategory)
 {
     if (await itemCategory.Validate(db))
     {
         db.ItemCategories.Attach(itemCategory);
         await db.SaveChangesAsync();
     }
 }
Exemplo n.º 2
0
        public static async Task UpdateItemCategory(this AppDbContext db, ItemCategory itemCategory)
        {
            if (await itemCategory.Validate(db))
            {
                var i = await db.ItemCategories.FindAsync(itemCategory.Id);

                i.Label = itemCategory.Label;
                await db.SaveChangesAsync();
            }
        }