示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            // In production, the React files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/build";
            });


            // MediatR will scan all my aspnet core project for implementation of the required interface.
            services.AddMediatR(typeof(Startup));



            PersistenceModules.Register(services);
            ServiceModules.Register(services);
        }
示例#2
0
        static void Main(string[] args)
        {
            var                   parts                = Db.Parts;
            var                   modules              = Db.Modules;
            var                   configurations       = Db.Configurations;
            ServiceParts          serviceParts         = new ServiceParts();
            ServiceModules        serviceModules       = new ServiceModules();
            ServiceConfigurations serviceConfiguration = new ServiceConfigurations();
            List <Part>           cartP                = new List <Part>();
            List <Module>         cartM                = new List <Module>();
            List <Configuration>  cartC                = new List <Configuration>();

            while (true)
            {
                Console.Clear();
                Console.WriteLine("Welcome!");
                Console.WriteLine("Choose Action:");
                Console.WriteLine("1. Part");
                Console.WriteLine("2. Module");
                Console.WriteLine("3. Configuration");
                int input = int.Parse(Console.ReadLine());
                if (input == 1)
                {
                    while (true)
                    {
                        Console.Clear();
                        UiService.ChooseAction();
                        int input1 = int.Parse(Console.ReadLine());
                        if (input1 == 1)
                        {
                            var nesto = serviceParts.ShowProductsByPart(parts, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else if (input1 == 2)
                        {
                            var nesto = serviceParts.ShowByPriceOfPart(parts, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else if (input1 == 3)
                        {
                            var nesto = serviceParts.ShowByTypeOfPart(parts, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("Enter valid action! Press any key.");
                            Console.ReadLine();
                            continue;
                        }
                    }
                }
                else if (input == 2)
                {
                    while (true)
                    {
                        UiService.ChooseAction();
                        int input1 = int.Parse(Console.ReadLine());
                        if (input1 == 1)
                        {
                            var nesto = serviceModules.ShowProductsByModules(modules, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else if (input1 == 2)
                        {
                            var nesto = serviceModules.ShowByPriceOfModules(modules, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else if (input1 == 3)
                        {
                            var nesto = serviceModules.ShowByTypeModules(modules, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("Enter valid action! Press any key.");
                            Console.ReadLine();
                            continue;
                        }
                    }
                }
                else if (input == 3)
                {
                    while (true)
                    {
                        UiService.ChooseAction();
                        int input1 = int.Parse(Console.ReadLine());
                        if (input1 == 1)
                        {
                            var nesto = serviceConfiguration.ShowProductsByConfigurations(configurations, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else if (input1 == 2)
                        {
                            var nesto = serviceConfiguration.ShowByPriceOfConfigurations(configurations, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else if (input1 == 3)
                        {
                            var nesto = serviceConfiguration.ShowByPriceOfConfigurations(configurations, cartP, cartM, cartC);
                            if (!nesto)
                            {
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("Enter valid action! Press any key.");
                            Console.ReadLine();
                            continue;
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Not a valid action!");
                    Console.WriteLine("Press any key to try again!");
                    Console.ReadLine();
                    continue;
                }
            }
        }
示例#3
0
 private static void MapperModules(Container container)
 {
     AplicationServiceModules.Register(container);
     ServiceModules.Register(container);
     RepositoryModules.Register(container);
 }