public static void AddActivationCode(Cart cart, Team5_Db db)
        {
            for (int i = 0; i < cart.Quantity; i++)
            {
                OrderDetail order = new OrderDetail
                {
                    ActivationCode = Guid.NewGuid().ToString().Substring(3, 15),
                    UserId         = cart.UserId,
                    ProductId      = cart.ProductId,
                    PurchaseDate   = DateTime.Today.Date
                };

                db.Add(order);
                db.SaveChanges();
            }

            return;
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, Team5_Db db)
        {
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Product}/{action=ListProducts}/{id?}");
            });

            /*
             * db.Database.EnsureDeleted();
             * db.Database.EnsureCreated();
             *
             * SeedData seed = new SeedData(db);
             * seed.Init(); */
        }
 public LoginController(Team5_Db db, CartItems cartitems)
 {
     this.db        = db;
     this.cartitems = cartitems;
 }
Ejemplo n.º 4
0
 public RegistrateController(Team5_Db db)
 {
     this.db = db;
 }
Ejemplo n.º 5
0
 public ProductController(Team5_Db db)
 {
     this.db = db;
 }
 public PurchaseController(Team5_Db db)
 {
     this.db = db;
 }
 public GalleryController(Team5_Db db)
 {
     this.db = db;
 }
Ejemplo n.º 8
0
 public SessionController(Team5_Db db)
 {
     this.db = db;
 }
Ejemplo n.º 9
0
 public LogoutController(Team5_Db db)
 {
     this.db = db;
 }
Ejemplo n.º 10
0
 public CartController(Team5_Db db)
 {
     this.db = db;
 }