private static void SeedOrders(ChuskaDbContext db) { if (db.Orders.Count() != 0) { return; } var order = new Order { Product = db.Products.FirstOrDefault(p => p.Name == "Darmush"), User = db.Users.FirstOrDefault(u => u.UserName == "User") }; db.Orders.Add(order); db.SaveChanges(); order = new Order { Product = db.Products.FirstOrDefault(p => p.Name == "Double Darmush"), User = db.Users.FirstOrDefault(u => u.UserName == "User") }; db.Orders.Add(order); db.SaveChanges(); }
private static void SeedProducts(ChuskaDbContext db) { if (db.Products.Count() != 0) { return; } var prodRange = new List <Product>(); var product = new Product { Name = "First Product", Price = 1, Type = Models.Enums.ProdType.Health, Description = "Some Description" }; prodRange.Add(product); product = new Product { Name = "SecondProduct", Price = 3, Type = Models.Enums.ProdType.Health, Description = "Some Description" }; prodRange.Add(product); product = new Product { Name = "Small Darmush", Price = 9.99m, Type = Models.Enums.ProdType.Health, Description = "Some Looooooooooooooooooooooooooooooooooond Description" }; prodRange.Add(product); db.Products.AddRange(prodRange); db.SaveChanges(); }
private static void SeedProducts(ChuskaDbContext db) { if (db.Products.Count() != 0) { return; } var prodRange = new List <Product>(); var product = new Product { Name = "Darmush", Price = 1.5m, Type = Models.Enums.ProdType.Health, Description = "Голям дармуш" }; prodRange.Add(product); product = new Product { Name = "Double Darmush", Price = 1.9m, Type = Models.Enums.ProdType.Health, Description = "Двоен дармуш" }; prodRange.Add(product); product = new Product { Name = "Small Darmush", Price = 1.01m, Type = Models.Enums.ProdType.Health, Description = "Малкият дармуш" }; prodRange.Add(product); db.Products.AddRange(prodRange); db.SaveChanges(); }
//TODO: Authorization, Checkboxes fix public BaseController() { this.db = new ChuskaDbContext(); }
public ProductsService(ChuskaDbContext context) { this.context = context; }
protected BaseController() { this.DbContext = new ChuskaDbContext(); this.HashService = new HashService(new FileLogger()); }
public OrdersService(ChuskaDbContext context) { this.context = context; }
public OrdersController(ChuskaDbContext chuskaDbContext, IMapper mapper, UserManager <ChushkaUser> userManager) { this.db = chuskaDbContext; this.mapper = mapper; this.userManager = userManager; }
public ProductsController(ChuskaDbContext context, IMapper mapper) { this.db = context; this.mapper = mapper; }
public UsersService(ChuskaDbContext db) { _db = db; }
public HomeController(ChuskaDbContext chuskaDbContext, IMapper mapper) { this.db = chuskaDbContext; this.mapper = mapper; }