Example #1
0
        public static void SeedOrders(this ScvContext context)
        {
            if (!context.Orders.Any())
            {
                var orderNumber = 1;

                context.Orders.AddRange
                (
                    new Order
                    (
                        Guid.Parse("3685851e-ef23-4b64-a8bb-92deb07e24a0"),
                        OrderStatus.Closed,
                        Guid.Parse("b3cd53fa-f3c4-47ee-8397-579a932571e7"),
                        orderNumber++,
                        DateTime.Now
                    )
                {
                    OrderItems = new List <OrderItem>
                    {
                        new OrderItem
                        (
                            Guid.Parse("6a1842f1-7466-474d-94cb-6e254d6f1724"),
                            1,
                            5_000M * 1.25M,
                            Guid.Parse("3685851e-ef23-4b64-a8bb-92deb07e24a0"),
                            Guid.Parse("7a95fc88-b230-4167-abd3-b9237b8a845b")
                        )
                    },
Example #2
0
        protected ScvContext CreateContext()
        {
            var services = new ServiceCollection();

            services.AddEFSecondLevelCache();

            services.AddScoped(typeof(ICacheManager <>), typeof(BaseCacheManager <>));
            services.AddSingleton(typeof(ICacheManagerConfiguration),
                                  new ConfigurationBuilder()
                                  .WithJsonSerializer()
                                  .WithMicrosoftMemoryCacheHandle()
                                  .WithExpiration(ExpirationMode.Absolute, TimeSpan.FromMilliseconds(1))
                                  .Build());

            var serviceProvider = GetServiceProvider(services);

            var options = new DbContextOptionsBuilder <ScvContext>()
                          .UseSqlite(sqliteConnection)
                          .UseApplicationServiceProvider(serviceProvider)
                          .Options;

            var context = new ScvContext(options);

            return(context);
        }
Example #3
0
        public static void SeedBrands(this ScvContext context)
        {
            if (!context.Brands.Any())
            {
                context.Brands.AddRange
                (
                    new Brand
                    (
                        Guid.Parse("fd1c21b9-57c0-4c9c-9d63-7a775638ec4b"),
                        "Mont Blanc",
                        "montblanc".Image("BrandSeed")
                    ),
                    new Brand
                    (
                        Guid.Parse("c8d7ec20-96cd-456f-b11e-b3ce7c1dbdc8"),
                        "Parker",
                        "parker".Image("BrandSeed")
                    ),
                    new Brand
                    (
                        Guid.Parse("e5f62aae-5b27-41e4-a6b7-e5c62d734aae"),
                        "Crown",
                        "crown".Image("BrandSeed")
                    )
                );

                context.SaveChanges();
            }
        }
Example #4
0
        public static void SeedProviders(this ScvContext context)
        {
            if (!context.Providers.Any())
            {
                context.Providers.AddRange
                (
                    new Provider
                    (
                        Guid.Parse("3d461f70-24a8-4796-bb5a-768521bda2ee"),
                        "Mont Blanc Provider",
                        "https://montblanc-provider.com/api"
                    ),
                    new Provider
                    (
                        Guid.Parse("e3f2d6d9-daa0-4ea2-8a20-9af6896bdda8"),
                        "Parker Provider",
                        "https://parker-provider.com/api"
                    ),
                    new Provider
                    (
                        Guid.Parse("1406bbf9-92c2-41be-96ce-3a2b67123486"),
                        "Crown Provider",
                        "https://crown-provider.com/api"
                    )
                );

                context.SaveChanges();
            }
        }
Example #5
0
        public static void SeedUsers(this ScvContext context)
        {
            if (!context.Users.Any())
            {
                var(password1, salt1) = "123".Encrypt();
                var(password2, salt2) = "456".Encrypt();
                var(password3, salt3) = "789".Encrypt();

                context.Users.AddRange
                (
                    new User
                    (
                        Guid.Parse("b3cd53fa-f3c4-47ee-8397-579a932571e7"),
                        Customer,
                        "Fujika Maria Namoto",
                        "*****@*****.**",
                        password1,
                        salt1,
                        "namoto".Image("UserSeed")
                    ),
                    new User
                    (
                        Guid.Parse("5b00cc61-1e3a-41b6-8916-42b385265cf1"),
                        Seller,
                        "Fujika Maria Nakombi",
                        "*****@*****.**",
                        password2,
                        salt2,
                        "nakombi".Image("UserSeed")
                    ),
                    new User
                    (
                        Guid.Parse("73334fc2-0338-4a7c-9d1b-1703cac26bf1"),
                        Admin,
                        "Pedro K. Beludo",
                        "*****@*****.**",
                        password3,
                        salt3,
                        "kbeludo".Image("UserSeed")
                    )
                );

                context.SaveChanges();
            }
        }
Example #6
0
        public static void SeedProducts(this ScvContext context)
        {
            if (!context.Products.Any())
            {
                context.Products.AddRange
                (
                    // Mont Blanc
                    new Product
                    (
                        Guid.Parse("7a95fc88-b230-4167-abd3-b9237b8a845b"),
                        "MEISTERSTUCK MOZ-SOLIT-VER",
                        25,
                        5_000M,
                        5_000M * 1.25M,
                        Guid.Parse("fd1c21b9-57c0-4c9c-9d63-7a775638ec4b"),
                        Guid.Parse("3d461f70-24a8-4796-bb5a-768521bda2ee"),
                        "meisterstuck-moz-solit-ver".Image("ProductSeed")
                    ),
                    new Product
                    (
                        Guid.Parse("8c1486c0-fe23-404b-8ecc-806831321d9d"),
                        "MEISTERSTUCK CLASSIC",
                        25,
                        2_000M,
                        2_000M * 1.25M,
                        Guid.Parse("fd1c21b9-57c0-4c9c-9d63-7a775638ec4b"),
                        Guid.Parse("3d461f70-24a8-4796-bb5a-768521bda2ee"),
                        "meisterstuck-classic".Image("ProductSeed")
                    ),
                    new Product
                    (
                        Guid.Parse("ec59e5bd-417a-42da-bf83-d04e9c7d854a"),
                        "MEISTERSTUCK MOZART",
                        25,
                        2_100M,
                        2_100M * 1.25M,
                        Guid.Parse("fd1c21b9-57c0-4c9c-9d63-7a775638ec4b"),
                        Guid.Parse("3d461f70-24a8-4796-bb5a-768521bda2ee"),
                        "meisterstuck-mozart".Image("ProductSeed")
                    ),
                    // Parker
                    new Product
                    (
                        Guid.Parse("c9df536f-dd5d-41ff-b8d2-63b794a7a888"),
                        "INFLECTION",
                        50,
                        1_000M,
                        1_000M * 1.25M,
                        Guid.Parse("c8d7ec20-96cd-456f-b11e-b3ce7c1dbdc8"),
                        Guid.Parse("e3f2d6d9-daa0-4ea2-8a20-9af6896bdda8"),
                        "inflection".Image("ProductSeed")
                    ),
                    new Product
                    (
                        Guid.Parse("bf7ece8a-de36-4ad6-aabe-20abdde5996c"),
                        "DUOFOLD-3 CENTENNIAL",
                        50,
                        6_500M,
                        6_500M * 1.25M,
                        Guid.Parse("c8d7ec20-96cd-456f-b11e-b3ce7c1dbdc8"),
                        Guid.Parse("e3f2d6d9-daa0-4ea2-8a20-9af6896bdda8"),
                        "duofold-3-centennial".Image("ProductSeed")
                    ),
                    new Product
                    (
                        Guid.Parse("e2e93749-6caf-49ae-9e79-f9d8a61b20cf"),
                        "SONNET-4 CHISSELED-PRATA-CT",
                        50,
                        3_000M,
                        3_000M * 1.25M,
                        Guid.Parse("c8d7ec20-96cd-456f-b11e-b3ce7c1dbdc8"),
                        Guid.Parse("e3f2d6d9-daa0-4ea2-8a20-9af6896bdda8"),
                        "sonnet-4-chisseled".Image("ProductSeed")
                    ),
                    // Crown
                    new Product
                    (
                        Guid.Parse("5514920c-4fb8-44b8-aed6-83eb29e2635a"),
                        "CLASSIC BARCELONA",
                        100,
                        75M,
                        75M * 1.25M,
                        Guid.Parse("e5f62aae-5b27-41e4-a6b7-e5c62d734aae"),
                        Guid.Parse("1406BBF9-92C2-41BE-96CE-3A2B67123486"),
                        "classic-barcelona".Image("ProductSeed")
                    ),
                    new Product
                    (
                        Guid.Parse("6c67dbb1-05a3-4ea8-a2f0-35a3966c9138"),
                        "FASHION CRISTAL",
                        100,
                        50M,
                        50M * 1.25M,
                        Guid.Parse("e5f62aae-5b27-41e4-a6b7-e5c62d734aae"),
                        Guid.Parse("1406BBF9-92C2-41BE-96CE-3A2B67123486"),
                        "fashion-cristal".Image("ProductSeed")
                    ),
                    new Product
                    (
                        Guid.Parse("bbaec517-01c3-4ec5-8644-5cb4759d57c6"),
                        "ROYAL COLLECT MARFIM LACQ",
                        100,
                        350M,
                        350M * 1.25M,
                        Guid.Parse("e5f62aae-5b27-41e4-a6b7-e5c62d734aae"),
                        Guid.Parse("1406BBF9-92C2-41BE-96CE-3A2B67123486"),
                        "royal-collect-marfim-lacq".Image("ProductSeed")
                    )
                );

                context.SaveChanges();
            }
        }
 public SignInController(ScvContext scvContext, IConfiguration configuration)
 {
     this.scvContext    = scvContext;
     this.configuration = configuration;
 }
Example #8
0
 public StoreController(ScvContext scvContext)
 {
     this.scvContext = scvContext;
 }
Example #9
0
 public FakeIProviderService(ScvContext scvContext)
 {
     this.scvContext = scvContext;
 }
 public ProvidersController(ScvContext scvContext)
 {
     this.scvContext = scvContext;
 }
Example #11
0
 public BrandsController(ScvContext scvContext)
 {
     this.scvContext = scvContext;
 }
            public TheGetMethod()
            {
                scvContext = CreateContext();

                providersController = new ProvidersController(scvContext);
            }
Example #13
0
        public CartController(ScvContext scvContext, IProviderService providerService)
        {
            this.scvContext = scvContext;

            this.providerService = providerService;
        }