public static void EnsurePopulated(IApplicationBuilder app)
        {
            TechnoStoreDbContext context = app.ApplicationServices.CreateScope().ServiceProvider
                                           .GetRequiredService <TechnoStoreDbContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }

            if (!context.OrderDetails.Any())
            {
                context.OrderDetails.AddRange(

                    new OrderDetail()
                {
                    OrderId   = 1,
                    ProductId = 1,
                    Price     = 1,
                    Quantity  = 1
                }
                    );
                context.SaveChanges();
            }
        }
Beispiel #2
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            TechnoStoreDbContext context = app.ApplicationServices.CreateScope().ServiceProvider
                                           .GetRequiredService <TechnoStoreDbContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }

            if (!context.Payments.Any())
            {
                context.Payments.AddRange(

                    new Payment()
                {
                    PaymentType = "Kredi / Banka Kartı"
                },

                    new Payment()
                {
                    PaymentType = "Kapıda Ödeme"
                },

                    new Payment()
                {
                    PaymentType = "Havale"
                }

                    );
                context.SaveChanges();
            }
        }
Beispiel #3
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            TechnoStoreDbContext context = app.ApplicationServices.CreateScope().ServiceProvider
                                           .GetRequiredService <TechnoStoreDbContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }

            if (!context.Coupons.Any())
            {
                context.Coupons.AddRange(

                    new Coupon()
                {
                    Code               = "COUPONFIRST",
                    EndDate            = DateTime.Now,
                    DiscountPercentage = 30,
                    IsActive           = true
                },

                    new Coupon()
                {
                    Code               = "COUPONSECOND",
                    EndDate            = new DateTime(2020, 12, 25),
                    DiscountPercentage = 30,
                    IsActive           = true
                }

                    );
                context.SaveChanges();
            }
        }
Beispiel #4
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            TechnoStoreDbContext context = app.ApplicationServices.CreateScope().ServiceProvider
                                           .GetRequiredService <TechnoStoreDbContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }

            if (!context.Shippers.Any())
            {
                context.Shippers.AddRange(

                    new Shipper()
                {
                    CompanyName = "Yurtiçi Kargo",
                    Phone       = "444 99 99"
                },

                    new Shipper()
                {
                    CompanyName = "Aras Kargo",
                    Phone       = "444 25 52"
                },

                    new Shipper()
                {
                    CompanyName = "MNG Kargo",
                    Phone       = "444 06 06"
                },

                    new Shipper()
                {
                    CompanyName = "Sürat Kargo",
                    Phone       = "0850 202 0 202"
                },

                    new Shipper()
                {
                    CompanyName = "PTT Kargo",
                    Phone       = "444 17 88"
                },

                    new Shipper()
                {
                    CompanyName = "UPS",
                    Phone       = "444 00 33"
                }

                    );
                context.SaveChanges();
            }
        }
Beispiel #5
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            TechnoStoreDbContext context = app.ApplicationServices.CreateScope().ServiceProvider
                                           .GetRequiredService <TechnoStoreDbContext>();

            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }

            if (!context.Categories.Any())
            {
                context.Categories.AddRange(

                    new Category()
                {
                    Name        = "Gaming Laptop",
                    Description = "Yüksek miktarda işlem gücü gerektiren video oyunlarını oynamak için tasarlanmış kişisel bilgisayarlar.",
                },

                    new Category()
                {
                    Name        = "Ev - Ofis Laptop'ları",
                    Description = "Günlük temel düzeyde kullanımı temel alan ev - ofis bilgisayarları.",
                },

                    new Category()
                {
                    Name        = "İkisi Bir Arada",
                    Description = "Hem normal hem de dokunmatik işleve sahip bilgisayarlar"
                }

                    );
                context.SaveChanges();
            }
        }
Beispiel #6
0
        public static void EnsurePopulated(IApplicationBuilder app)
        {
            TechnoStoreDbContext context = app.ApplicationServices.CreateScope().ServiceProvider
                                           .GetRequiredService <TechnoStoreDbContext>();

            if (EnumerableExtensions.Any(context.Database.GetPendingMigrations()))
            {
                context.Database.Migrate();
            }

            if (!EnumerableExtensions.Any(context.Products))
            {
                context.Products.AddRange(

                    new Product()
                {
                    Name            = "Asus X515JF-BR070T",
                    Vendor          = "Asus",
                    RealPrice       = 12200,
                    UnitPrice       = 4898,
                    UnitInStock     = 10,
                    CategoryId      = 2,
                    SKU             = "TSV00000X5TSR",
                    ProcessorVendor = "Intel",
                    ProcessorType   = "Intel Core i3 1005G1",
                    GraphicsCard    = "Intel UHD Graphics",
                    DiscCapacity    = "256 GB",
                    MemoryCapacity  = "4 GB",
                    Description     = "Asus X515JF-BR070T Intel Core i3 1005G1 4GB 256GB SSD Windows 10 Home 15.6 Taşınabilir Bilgisayar",
                    Image1          = "format_webp (1).jpg",
                    Image2          = "format_webp (3).jpg",
                    Image3          = "format_webp (4).jpg"
                },

                    new Product()
                {
                    Name            = "MSI GF63 Thin 9SCSR-1053XTR",
                    Vendor          = "MSI",
                    RealPrice       = 14751,
                    UnitPrice       = 7776,
                    UnitInStock     = 25,
                    CategoryId      = 1,
                    SKU             = "TSV00000X9GRY",
                    ProcessorVendor = "Intel",
                    ProcessorType   = "Intel Core i5 9300H",
                    GraphicsCard    = "NVIDIA GTX 1650Ti",
                    DiscCapacity    = "256 GB",
                    MemoryCapacity  = "8 GB",
                    Description     = "MSI GF63 Thin 9SCSR-1053XTR Intel Core i5 9300H 8GB 256GB SSD GTX 1650Ti Freedos 15.6\" FHD Taşınabilir Bilgisayar",
                    Image1          = "msigf63_1.jpg",
                    Image2          = "msigf63_2.jpg",
                    Image3          = "msigf63_3.jpg"
                },

                    new Product()
                {
                    Name            = "Dell Vostro 3501",
                    Vendor          = "Dell",
                    RealPrice       = 6250,
                    UnitPrice       = (decimal)(5999.4),
                    UnitInStock     = 100,
                    CategoryId      = 2,
                    SKU             = "TSV00000X9GRQ",
                    ProcessorVendor = "Intel",
                    ProcessorType   = "Intel Core i3 1005G1",
                    GraphicsCard    = "Intel UHD Graphics",
                    DiscCapacity    = "1 TB",
                    MemoryCapacity  = "8 GB",
                    Description     = "Dell Vostro 3501 Intel Core i3 1005G1 8GB 256GB SSD Windows 10 Home 15.6\" FHD Taşınabilir Bilgisayar FB05W82N",
                    Image1          = "Dell Vostro 3501_1.jpg",
                    Image2          = "Dell Vostro 3501_2.jpg",
                    Image3          = "Dell Vostro 3501_3.jpg"
                },

                    new Product()
                {
                    Name            = "Apple Macbook Pro M1",
                    Vendor          = "Apple",
                    RealPrice       = 20100,
                    UnitPrice       = (decimal)(14298.99),
                    UnitInStock     = 3,
                    CategoryId      = 2,
                    SKU             = "TSV00000OSBNX",
                    ProcessorVendor = "Apple",
                    ProcessorType   = "M1",
                    GraphicsCard    = "AMD Radeon Pro 5600M",
                    DiscCapacity    = "256 GB",
                    MemoryCapacity  = "8 GB",
                    Description     = "Apple Macbook Pro M1 Çip 8GB 256GB macOS 13\" QHD Taşınabilir Bilgisayar Uzay Grisi MYD82TU/A",
                    Image1          = "Apple Macbook Pro M1_1.jpg",
                    Image2          = "Apple Macbook Pro M1_2.jpg",
                    Image3          = "Apple Macbook Pro M1_3.jpg"
                },

                    new Product()
                {
                    Name            = "Lenovo IdeaPad Creator 5",
                    Vendor          = "Lenovo",
                    RealPrice       = 10000,
                    UnitPrice       = 9699,
                    UnitInStock     = 30,
                    CategoryId      = 1,
                    SKU             = "TSV00000LK9W1",
                    ProcessorVendor = "Intel",
                    ProcessorType   = "Intel Core i5 10300H",
                    GraphicsCard    = "NVIDIA GTX 1650Ti",
                    DiscCapacity    = "512 GB",
                    MemoryCapacity  = "16 GB",
                    Description     = "Lenovo IdeaPad Creator 5 Intel Core i5 10300H 16GB 512GB SSD GTX 1650Ti Freedos 15.6'\' FHD Taşınabilir Bilgisayar 82D4002KTX",
                    Image1          = "Lenovo IdeaPad Creator 5_1.jpg",
                    Image2          = "Lenovo IdeaPad Creator 5_2.jpg",
                    Image3          = "Lenovo IdeaPad Creator 5_3.jpg"
                },

                    new Product()
                {
                    Name            = "Asus TUF Gaming A15 FA506II-BQ200",
                    Vendor          = "Asus",
                    RealPrice       = 12200,
                    UnitPrice       = 10114,
                    UnitInStock     = 60,
                    CategoryId      = 1,
                    SKU             = "TSV00000UMKL4",
                    ProcessorVendor = "AMD",
                    ProcessorType   = "AMD Ryzen 7 4800H",
                    GraphicsCard    = "NVIDIA GTX1650Ti",
                    DiscCapacity    = "1 TB",
                    MemoryCapacity  = "8 GB",
                    Description     = "Asus TUF Gaming A15 FA506II-BQ200 AMD Ryzen 7 4800H 8GB 1TB + 256GB SSD GTX1650Ti FreeDos 15.6\" FHD Taşınabilir Bilgisayar",
                    Image1          = "Asus TUF Gaming A15 FA506II-BQ200_1.jpg",
                    Image2          = "Asus TUF Gaming A15 FA506II-BQ200_2.jpg",
                    Image3          = "Asus TUF Gaming A15 FA506II-BQ200_3.jpg"
                }

                    );
                context.SaveChanges();
            }
        }
Beispiel #7
0
 public EfOrderRepository(TechnoStoreDbContext db)
 {
     _db = db;
 }
Beispiel #8
0
 public EfCouponRepository(TechnoStoreDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Beispiel #9
0
 public HomeService(TechnoStoreDbContext dbContext)
 {
     _dbContext = dbContext;
 }
 public EfProductRepository(TechnoStoreDbContext context)
 {
     _context = context;
 }
 public EfOrderDetailRepository(TechnoStoreDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Beispiel #12
0
 public EfPaymentRepository(TechnoStoreDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Beispiel #13
0
 public void Update(Table table)
 {
     using var db = new TechnoStoreDbContext();
     db.Set <Table>().Update(table);
     db.SaveChanges();
 }
Beispiel #14
0
 public EfShipperRepository(TechnoStoreDbContext dbContext)
 {
     _dbContext = dbContext;
 }
 public EfAddressRepository(TechnoStoreDbContext context)
 {
     _context = context;
 }
Beispiel #16
0
 public EfCategoryRepository(TechnoStoreDbContext context)
 {
     _context = context;
 }
Beispiel #17
0
 public List <Table> GetAllOrders()
 {
     using var db = new TechnoStoreDbContext();
     return(db.Set <Table>().ToList());
 }
Beispiel #18
0
 public Table GetOrderWithId(int id)
 {
     using var db = new TechnoStoreDbContext();
     return(db.Set <Table>().Find(id));
 }