Exemplo n.º 1
0
 public AdminManagment(ICategoryDatabaseService categorySer, IPartnersDatabaseService partnerSer, IPartsDatabaseService partSer
                       , IStatusDatabaseService statusSer, IBrandsDatabaseService brandSer)
 {
     categoryService = categorySer;
     partnerService  = partnerSer;
     partService     = partSer;
     statusService   = statusSer;
     brandService    = brandSer;
 }
 public ShoppingCartController(IPartsDatabaseService partsDatabaseService, IOrdersDatabaseService ordersDatabaseService
                               , IPartnersDatabaseService partnersDatabase, IStatusDatabaseService statusDatabase, IUserDatabaseService usDatabase)
 {
     partsService   = partsDatabaseService;
     ordersService  = ordersDatabaseService;
     partnerService = partnersDatabase;
     statusService  = statusDatabase;
     userService    = usDatabase;
 }
Exemplo n.º 3
0
 public AdminEditManagment(ICategoryDatabaseService categorySer, IPartnersDatabaseService partnerSer, IPartsDatabaseService partSer
                           , IStatusDatabaseService statusSer, IBrandsDatabaseService brandSer, IUserDatabaseService userDatabaseService)
 {
     categoryService = categorySer;
     partnerService  = partnerSer;
     partService     = partSer;
     statusService   = statusSer;
     brandService    = brandSer;
     userService     = userDatabaseService;
 }
        public static async Task SeedData(UserManager <User> userManager,
                                          RoleManager <Role> roleManager,
                                          IRoleDatabaseService roleDatabaseService
                                          , IUserDatabaseService userDatabaseService
                                          , IPartnersDatabaseService partnersDatabase
                                          , IBrandsDatabaseService brandsDatabaseService
                                          , ICategoryDatabaseService categoryDatabaseService
                                          , IStatusDatabaseService statusDatabaseService)
        {
            await SeedRoles(roleManager, roleDatabaseService);

            //await SeedData(userDatabaseService, partnersDatabase, brandsDatabaseService, categoryDatabaseService, statusDatabaseService);
        }
Exemplo n.º 5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env
                              , UserManager <User> userManager,
                              RoleManager <Role> roleManager,
                              IRoleDatabaseService roleDbService, IUserDatabaseService userDatabaseService
                              , IPartnersDatabaseService partnersDatabase
                              , IBrandsDatabaseService brandsDatabaseService
                              , ICategoryDatabaseService categoryDatabaseService
                              , IStatusDatabaseService statusDatabaseService)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();
            app.UseSession();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapControllers();
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });


            IdentityDataInitializer.SeedData(userManager, roleManager, roleDbService, userDatabaseService, partnersDatabase, brandsDatabaseService, categoryDatabaseService, statusDatabaseService).Wait();
        }
        public static async Task SeedData(IUserDatabaseService userDatabaseService
                                          , IPartnersDatabaseService partnersDatabase
                                          , IBrandsDatabaseService brandsDatabaseService
                                          , ICategoryDatabaseService categoryDatabaseService
                                          , IStatusDatabaseService statusDatabaseService)
        {
            if (partnersDatabase.GetPartners().Count == 0)
            {
                Partner partner = new Partner();
                partner.Name    = "Валкит ЛТД ЕООД";
                partner.Bulstat = "6592345675";
                partnersDatabase.AddPartner(partner);
            }

            if (brandsDatabaseService.GetBrands().Count == 0)
            {
                Brand brand = new Brand();
                brand.Name = "БМВ";
                BrandDetail brandDetail = new BrandDetail();
                brandDetail.EngineType = "дизел";
                brandDetail.Year       = 2012;
                brandDetail.Power      = 116;
                brandDetail.Brand      = brand;
                brandsDatabaseService.AddBrandDetail(brandDetail);

                brandDetail.EngineType = "бензин";
                brandDetail.Year       = 2019;
                brandDetail.Power      = 240;
                brandDetail.Brand      = brand;
                brandsDatabaseService.AddBrandDetail(brandDetail);

                brand                  = new Brand();
                brand.Name             = "АУДИ";
                brandDetail.EngineType = "бензин";
                brandDetail.Year       = 2008;
                brandDetail.Power      = 109;
                brandDetail.Brand      = brand;
                brandsDatabaseService.AddBrandDetail(brandDetail);

                brand                  = new Brand();
                brand.Name             = "Хюндай";
                brandDetail.EngineType = "дизел";
                brandDetail.Year       = 2015;
                brandDetail.Power      = 109;
                brandDetail.Brand      = brand;
                brandsDatabaseService.AddBrandDetail(brandDetail);

                brand.Name             = "Мерцедес";
                brandDetail.EngineType = "газ";
                brandDetail.Year       = 2011;
                brandDetail.Power      = 142;
                brandDetail.Brand      = brand;
                brandsDatabaseService.AddBrandDetail(brandDetail);

                brandDetail.EngineType = "дизел";
                brandDetail.Year       = 2004;
                brandDetail.Power      = 109;
                brandDetail.Brand      = brand;
                brandsDatabaseService.AddBrandDetail(brandDetail);

                brand.Name             = "Пежо";
                brandDetail.EngineType = "бензин";
                brandDetail.Year       = 2008;
                brandDetail.Power      = 109;
                brandDetail.Brand      = brand;
                brandsDatabaseService.AddBrandDetail(brandDetail);

                Category category = new Category();
                category.Name = "Аксесоари";
                categoryDatabaseService.AddCategory(category);
                category.Name = "Спирачни дискове";
                categoryDatabaseService.AddCategory(category);
                category.Name = "Гуми";
                categoryDatabaseService.AddCategory(category);
                category.Name = "Накладки";
                categoryDatabaseService.AddCategory(category);
                category.Name = "Автохимия";
                categoryDatabaseService.AddCategory(category);
                category.Name = "Крушки за фарове";
                categoryDatabaseService.AddCategory(category);
                category.Name = "Други";
                categoryDatabaseService.AddCategory(category);

                Status status = new Status();
                status.Name = "Очаква се обработка";
                statusDatabaseService.AddStatus(status);
                status.Name = "Получена в офис";
                statusDatabaseService.AddStatus(status);
                status.Name = "Изпратена от доставчик";
                statusDatabaseService.AddStatus(status);
                status.Name = "Изпратена";
                statusDatabaseService.AddStatus(status);
                status.Name = "Получена";
                statusDatabaseService.AddStatus(status);
                status.Name = "Пренасочена към друг адрес";
                statusDatabaseService.AddStatus(status);
            }
        }