Example #1
0
        public static async Task SeedAsync(GroceryContext context)
        {
            if (!context.CatalogItems.Any(x => x.Id == -1) && context.CatalogTypes.Any())
            {
                context.CatalogItems.Add(new CatalogItem
                {
                    Id          = -1,
                    Name        = "Produto Personalizado",
                    ShowOnShop  = false,
                    CatalogType = context.CatalogTypes.First()
                });

                await context.SaveChangesAsync();
            }

            if (!context.invoiceConfigs.Any())
            {
                foreach (var item in _weeks)
                {
                    context.invoiceConfigs.Add(new InvoiceConfig
                    {
                        Week = item
                    });
                }
                await context.SaveChangesAsync();
            }
        }
 public BasketGroceryRepository(GroceryContext dbContext) : base(dbContext)
 {
 }
Example #3
0
 public static void EnsureDatabaseMigrations(GroceryContext groceryContext)
 {
     groceryContext.Database.Migrate();
 }
 public EfGroceryRepository(GroceryContext dbContext)
 {
     _dbContext = dbContext;
 }
Example #5
0
 public EditModel(Infrastructure.Data.GroceryContext context, IOptions <BackofficeSettings> settings, IBackofficeService service)
 {
     _context            = context;
     _service            = service;
     _backofficeSettings = settings.Value;
 }