示例#1
0
        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();
        }
示例#2
0
        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();
        }
示例#3
0
        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();
        }
示例#4
0
 //TODO: Authorization, Checkboxes fix
 public BaseController()
 {
     this.db = new ChuskaDbContext();
 }
示例#5
0
 public ProductsService(ChuskaDbContext context)
 {
     this.context = context;
 }
示例#6
0
 protected BaseController()
 {
     this.DbContext   = new ChuskaDbContext();
     this.HashService = new HashService(new FileLogger());
 }
示例#7
0
 public OrdersService(ChuskaDbContext context)
 {
     this.context = context;
 }
示例#8
0
 public OrdersController(ChuskaDbContext chuskaDbContext, IMapper mapper, UserManager <ChushkaUser> userManager)
 {
     this.db          = chuskaDbContext;
     this.mapper      = mapper;
     this.userManager = userManager;
 }
示例#9
0
 public ProductsController(ChuskaDbContext context, IMapper mapper)
 {
     this.db     = context;
     this.mapper = mapper;
 }
示例#10
0
 public UsersService(ChuskaDbContext db)
 {
     _db = db;
 }
示例#11
0
 public HomeController(ChuskaDbContext chuskaDbContext, IMapper mapper)
 {
     this.db     = chuskaDbContext;
     this.mapper = mapper;
 }