public UnitOfWork(AutoSolutionContext context)
 {
     _context                 = context;
     User                     = new UserRepository(_context);
     City                     = new CityRepository(_context);
     CityArea                 = new CityAreaRepository(_context);
     Province                 = new ProvinceRepository(_context);
     ServiceCategory          = new ServiceCategoryRepository(_context);
     UserServiceCatogory      = new UserServiceCatogoryRepository(_context);
     VehicleManufacturer      = new VehicleManufacturerRepository(_context);
     RoleRepository           = new RoleRepository(_context);
     VehicleModel             = new VehicleModelRepository(_context);
     TransmissionType         = new TransmissionTypeRepository(_context);
     VehicleEngineType        = new VehicleEngineTypeRepository(_context);
     PartsProductsCategory    = new PartsProductsCategoryRepository(_context);
     PartsSubCategory         = new PartsSubCategoryRepository(_context);
     VehicleVersion           = new VehicleVersionRepository(_context);
     PartsProductManufacturer = new PartsProductManufacturerRepository(_context);
     PartsProducts            = new PartsProductsRepository(_context);
     Template                 = new TemplateRepository(_context);
     WishList                 = new WishListRepository(_context);
     Order                    = new OrderRepository(_context);
     OrderDetail              = new OrderDetailRepository(_context);
     OrderStatus              = new OrderStatusRepository(_context);
 }
        public CityAreaViewModel AddNewCityArea()
        {
            ProvinceRepository provinceRepository = new ProvinceRepository(new AutoSolutionContext());
            CityRepository     cityRepository     = new CityRepository(new AutoSolutionContext());
            CityAreaViewModel  cityAreaViewModel  = new CityAreaViewModel()
            {
                ProvinceList = provinceRepository.GetProvinces(),
                CityList     = cityRepository.GetCities(),
            };

            return(cityAreaViewModel);
        }
Example #3
0
        public ServiceProviderWraperForHome GetServiceProvidersHomeSearch(int PageNo, int TotalCount, SelectYourInterest selectYourInterest)
        {
            int Id = selectYourInterest.findYourMechanic.SelectedServiceCategory;
            ServiceCategoryRepository    serviceCategoryRepository    = new ServiceCategoryRepository(new AutoSolutionContext());
            ProvinceRepository           provinceRepository           = new ProvinceRepository(new AutoSolutionContext());
            CityRepository               cityRepository               = new CityRepository(new AutoSolutionContext());
            CityAreaRepository           cityAreaRepository           = new CityAreaRepository(new AutoSolutionContext());
            ServiceProviderWraperForHome serviceProviderWraperForHome = new ServiceProviderWraperForHome()
            {
                FindYourMechanicViewModel =
                {
                    ServiceCategoryList = serviceCategoryRepository.GetServiceCategoryDropDown(),
                    ProvinceList        = provinceRepository.GetProvincesForHome(),
                    CityList            = cityRepository.GetCitiesForHome()
                },
                ServiceCategoriesList        = AutoSolutionContext.ServiceCategories.ToList(),
                ServiceCategoryName          = AutoSolutionContext.ServiceCategories.Where(x => x.ServiceCategoryId == Id).FirstOrDefault(),
                serviceProviderViewModelList = (from u in AutoSolutionContext.User
                                                join ur in AutoSolutionContext.UserRoles
                                                on u.UserId equals ur.UserId
                                                join USC in AutoSolutionContext.UserServiceCatogories
                                                on u.UserId equals USC.UserId
                                                where ((ur.RolesId == 6) && (USC.ServiceCategoryId == Id) &&
                                                       (u.Cities.Province.ProvinceId == selectYourInterest.findYourMechanic.SelectedProvince) &&
                                                       (u.Cities.CityId == selectYourInterest.findYourMechanic.SelectedCity) &&
                                                       (u.CityAreaID == selectYourInterest.findYourMechanic.CityAreaID))
                                                orderby u.UserId
                                                select new ServiceProviderViewModel()
                {
                    First_Name = u.FirstName,
                    Last_Name = u.LastName,
                    Email = u.Email,
                    MobileNumber = u.MobileNumber,
                    PhoneNumber = u.PhoneNumber,
                    SelectedCity = u.Cities.CityName,
                    SelectedCityAreaName = u.CityArea.CityAreaName,
                    Address = u.Address,
                    BusinessDescription = u.BusinessDescription,
                    ImagePath = u.ImagePath,
                    IsActive = u.IsActive,
                    serviceCategoriesListFor = AutoSolutionContext.UserServiceCatogories.Where(x => x.UserId == u.UserId).Select(x => new ServiceCategoryViewModel
                    {
                        ServiceCategoryName = x.ServiceCategory.ServiceCategoryName
                    }).ToList()
                }

                                                ).Skip((PageNo - 1) * 10).Take(10).ToList(),

                Pager = new Pager(TotalCount, PageNo, 10)
            };

            return(serviceProviderWraperForHome);
        }
Example #4
0
        public ConsumerViewModel CreateConsumer()
        {
            var province = new ProvinceRepository(new AutoSolutionContext());
            var city     = new CityRepository(new AutoSolutionContext());
            var consumer = new ConsumerViewModel()
            {
                ProvincesList = province.GetProvinces(),
                CitiesList    = city.GetCities(),
            };

            return(consumer);
        }
        public CityAreaViewModel GetCityArea(int PageNo, int TotalCount)
        {
            CityRepository     cityRepository     = new CityRepository(new AutoSolutionContext());
            ProvinceRepository provinceRepository = new ProvinceRepository(new AutoSolutionContext());
            var cityAreaViewModel = new CityAreaViewModel()
            {
                ProvinceList = provinceRepository.GetProvinces(),
                CityList     = cityRepository.GetCities(),
                CityAreaList = AutoSolutionContext.CityAreas.OrderBy(x => x.CityAreaName).Skip((PageNo - 1) * 10).Take(10).ToList(),
                Pager        = new Pager(TotalCount, PageNo, 10)
            };

            return(cityAreaViewModel);
        }
Example #6
0
        public ServiceProviderViewModel CreateServiceProvider()

        {
            var province          = new ProvinceRepository(new AutoSolutionContext());
            var city              = new CityRepository(new AutoSolutionContext());
            var serviceCategories = new ServiceCategoryRepository(new AutoSolutionContext());
            var serviceProvider   = new ServiceProviderViewModel()
            {
                ProvincesList         = province.GetProvinces(),
                CitiesList            = city.GetCities(),
                ServiceCategoriesList = serviceCategories.GetServiceCategories()
            };

            return(serviceProvider);
        }
 public CityAreaViewModel GetCityArea(int PageNo, int TotalCount, string SearchTerm, string SelectedCity)
 {
     if ((!string.IsNullOrEmpty(SelectedCity)) && (!string.IsNullOrEmpty(SearchTerm)))
     {
         ProvinceRepository provinceRepository = new ProvinceRepository(new AutoSolutionContext());
         CityRepository     cityRepository     = new CityRepository(new AutoSolutionContext());
         int Selecteditem      = Convert.ToInt32(SelectedCity);
         var cityAreaViewModel = new CityAreaViewModel()
         {
             ProvinceList = provinceRepository.GetProvinces(),
             CityList     = cityRepository.GetCities(),
             CityAreaList = AutoSolutionContext.CityAreas.OrderBy(x => x.CityAreaName).Where(x => x.CityAreaName.ToLower().Contains(SearchTerm.ToLower()) && x.CityId == Selecteditem).Skip((PageNo - 1) * 10).Take(10).ToList(),
             Pager        = new Pager(TotalCount, PageNo, 10)
         };
         return(cityAreaViewModel);
     }
     return(null);
 }
Example #8
0
        public DashboardPersonalInformation GetUser(int id)
        {
            var user = GetByID(id);

            RoleRepository roleRepository = new RoleRepository(new AutoSolutionContext());
            var            UserRole       = roleRepository.CheckIsUserInRole(user.Email);
            var            province       = new ProvinceRepository(new AutoSolutionContext());
            var            city           = new CityRepository(new AutoSolutionContext());
            var            CityArea       = new CityAreaRepository(new AutoSolutionContext());
            DashboardPersonalInformation ServiceProviderViewModel = new DashboardPersonalInformation()
            {
                UserId           = user.UserId,
                First_Name       = user.FirstName,
                Last_Name        = user.LastName,
                Gender           = user.Gender,
                userRole         = UserRole[0].ToString(),
                PhoneNumber      = user.PhoneNumber,
                MobileNumber     = user.MobileNumber,
                Email            = user.Email,
                SelfAddress      = "Dummy",
                RegistrationDate = user.RegistrationDate,

                City             = user.Cities.CityName,
                ProvincesList    = province.GetProvincesForHome(),
                SelectedProvince = user.Cities.Province.ProvinceId.ToString(),
                CitiesList       = city.GetCitiesForHome(user.Cities.Province.ProvinceId.ToString()),
                SelectedCity     = user.CityId.ToString(),
            };

            if (UserRole[0] == "Service Provider")
            {
                ServiceProviderViewModel.CityArea             = user.CityArea?.CityAreaName;
                ServiceProviderViewModel.SelectedCityAreaName = user.CityArea.CityAreaName;
                ServiceProviderViewModel.SelectedCityAreaId   = user.CityAreaID.ToString();
            }
            return(ServiceProviderViewModel);
        }