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 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); }
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); }