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 VehicleVersionViewModel GetVehicleVersion(int PageNo, int TotalCount)
        {
            VehicleModelRepository vehicleModelRepository = new VehicleModelRepository(new AutoSolutionContext());
            var VehicleVersionViewModel = new VehicleVersionViewModel()
            {
                VehicleModelList   = vehicleModelRepository.GetVehicleModelDropDown(),
                VehicleVersionList = AutoSolutionContext.VehicleVersions.OrderBy(x => x.VehicleVersionName).Skip((PageNo - 1) * 10).Take(10).ToList(),
                Pager = new Pager(TotalCount, PageNo, 10)
            };

            return(VehicleVersionViewModel);
        }
        public VehicleVersionViewModel AddNewVehicleVerison()
        {
            VehicleModelRepository      vehicleModelRepository      = new VehicleModelRepository(new AutoSolutionContext());
            TransmissionTypeRepository  transmissionTypeRepository  = new TransmissionTypeRepository(new AutoSolutionContext());
            VehicleEngineTypeRepository vehicleEngineTypeRepository = new VehicleEngineTypeRepository(new AutoSolutionContext());
            VehicleVersionViewModel     vehicleVersionViewModel     = new VehicleVersionViewModel()
            {
                VehicleManufacturerList = vehicleModelRepository.GetVehicleManufacturerDropDown(),
                VehicleModelList        = vehicleModelRepository.GetVehicleModelDropDownEmpty(),
                TransmissionTypeList    = transmissionTypeRepository.GetTransmissionTypeDownEmpty(),
                EngineTypeList          = vehicleEngineTypeRepository.GetVehicleEngineTypeDropDownEmpty(),
            };

            return(vehicleVersionViewModel);
        }
 public VehicleVersionViewModel GetVehicleVersion(int PageNo, int TotalCount, string SearchTerm, string SelectedVehicleVersion)
 {
     if ((!string.IsNullOrEmpty(SelectedVehicleVersion)) && (!string.IsNullOrEmpty(SearchTerm)))
     {
         VehicleModelRepository vehicleModelRepository = new VehicleModelRepository(new AutoSolutionContext());
         int SelectedModel           = Convert.ToInt32(SelectedVehicleVersion);
         var VehicleVersionViewModel = new VehicleVersionViewModel()
         {
             VehicleModelList   = vehicleModelRepository.GetVehicleModelDropDownEmpty(),
             VehicleVersionList = AutoSolutionContext.VehicleVersions.OrderBy(x => x.VehicleVersionName).Where(x => x.VehicleVersionName.ToLower().Contains(SearchTerm.ToLower()) || x.VehicleModelId == SelectedModel).Skip((PageNo - 1) * 10).Take(10).ToList(),
             Pager = new Pager(TotalCount, PageNo, 10)
         };
         return(VehicleVersionViewModel);
     }
     return(null);
 }
Example #5
0
        public PartsProductsViewModel AddNewPartsProducts()
        {
            VehicleModelRepository             vehicleModelRepository             = new VehicleModelRepository(new AutoSolutionContext());
            PartsSubCategoryRepository         partsSubCategoryRepository         = new PartsSubCategoryRepository(new AutoSolutionContext());
            TransmissionTypeRepository         transmissionTypeRepository         = new TransmissionTypeRepository(new AutoSolutionContext());
            VehicleEngineTypeRepository        vehicleEngineTypeRepository        = new VehicleEngineTypeRepository(new AutoSolutionContext());
            PartsProductManufacturerRepository partsProductManufacturerRepository = new PartsProductManufacturerRepository(new AutoSolutionContext());
            PartsProductsViewModel             partsProductsViewModel             = new PartsProductsViewModel()
            {
                VehicleManufacturerList      = vehicleModelRepository.GetVehicleManufacturerDropDown(),
                PartsProductsCategoryList    = partsSubCategoryRepository.GetPartsProductCategoryDropDown(),
                PartsProductsSubCategoryList = partsSubCategoryRepository.GetPartsProductSubCategoryDropDownEmpty(),
                PartProductManufacturerList  = partsProductManufacturerRepository.GetPPManufacturerDropDownEmpty(),
                VehicleModelList             = vehicleModelRepository.GetVehicleModelDropDownEmpty(),
                //TransmissionTypeList = transmissionTypeRepository.GetTransmissionTypeDownEmpty(),
                //EngineTypeList = vehicleEngineTypeRepository.GetVehicleEngineTypeDropDownEmpty(),
            };

            return(partsProductsViewModel);
        }
Example #6
0
        public PartProductwraperForHome GetPartsProducts(int PageNo, int TotalCount, int id)
        {
            VehicleModelRepository vehicleModelRepository = new VehicleModelRepository(new AutoSolutionContext());

            PartsSubCategoryRepository partsSubCategoryRepository = new PartsSubCategoryRepository(new AutoSolutionContext());
            PartProductwraperForHome   partProductwraperForHome   = new PartProductwraperForHome()
            {
                FindYourPart =
                {
                    VehicleManufacturersList     = vehicleModelRepository.GetVehicleManufacturerDropDownForHome(),
                    VehicleModelsList            = vehicleModelRepository.GetVehicleModelDropDownEmptyForHome(),
                    PartsProductsCategoryList    = partsSubCategoryRepository.GetPartsProductCategoryDropDown(),
                    PartsProductsSubCategoryList = partsSubCategoryRepository.GetPartsProductSubCategoryDropDownEmpty()
                },
                PartsProductsCategory       = AutoSolutionContext.PartsProductsCategories.Where(x => x.PartsProductsCategoryId == id).FirstOrDefault(),
                PartsProductsViewModelsList =
                    (from ppsc in AutoSolutionContext.PartsProductsSubCategories
                     join pp in AutoSolutionContext.PartsProducts
                     on ppsc.PartsProductsSubCategoryId equals pp.PartsProductsSubCategoryId
                     where id == ppsc.PartsProductsCategoryId
                     orderby pp.AddedDate
                     select new PartsProductsViewModel()
                {
                    PartsProductName = pp.PartsProductName,
                    UnitPrice = pp.UnitPrice,
                    ShortDescription = pp.ShortDescription,
                    VehicleManufacturerName = pp.VehicleManufacturer.VehicleManufacturerName,
                    VehicleModelName = pp.VehicleModel.VehicleModelName,
                    startYear = pp.startYear,
                    EndYear = pp.EndYear
                }).Skip((PageNo - 1) * 12).Take(12).ToList(),
                Pager = new Pager(TotalCount, PageNo, 12)
            };

            return(partProductwraperForHome);
        }