Example #1
0
        public async Task <ActionResult> Index(BookServicePilotenPage currentPage, string city, string model,
                                               string serial, string register, string reference)
        {
            var customer = UserManager.GetActiveCustomer(HttpContext);
            var owner    = await _orgUser.GetOwnerAsync(customer);

            var userInfo = await _securityRepository.QueryUserAsync(SiteUser.UserName);

            var starredGarage = await _contactRepository.GetStarredGarageAsync(customer);

            if (string.IsNullOrWhiteSpace(city))
            {
                //city is empty, get the favorite
                city = starredGarage;
            }

            var cityInfo = (await _contactRepository.GetGaragesAsync(customer, city))?.FirstOrDefault();

            ViewData["starred"]   = cityInfo?.City == starredGarage;
            ViewData["reference"] = reference;

            return(View("~/Views/BookService/BookService.cshtml", new BookServicePilotenViewModel(currentPage)
            {
                Customer = customer,
                UserName = SiteUser.Name,
                OwnerEmail = owner.UserId == SiteUser.UserName ? null : owner?.Email,
                UserEmail = SiteUser.Email ?? string.Empty,
                MachineModel = model ?? string.Empty,
                MachineRegister = register ?? string.Empty,
                MachineSerialNumber = serial ?? string.Empty,
                PhoneNumber = userInfo?.UserName ?? string.Empty,
                City = city
            }));
        }
Example #2
0
        public async Task <ActionResult> Index(WorkshopPage currentPage, string query, string city)
        {
            if (!string.IsNullOrWhiteSpace(city))
            {
                return(await CityDetail(currentPage, city));
            }
            var activeCustomer = UserManager.GetActiveCustomer(HttpContext);

            ViewData["userName"] = SiteUser?.UserName ?? string.Empty;

            var garages       = await(_contactRepo.GetGaragesAsync(activeCustomer, query?.Trim() ?? string.Empty)) ?? new GarageWorkshop[0];
            var starredGarage = await _contactRepo.GetStarredGarageAsync(activeCustomer);

            foreach (var garage in garages)
            {
                garage.OwnStar = garage.City == starredGarage;
            }

            return(View("~/Views/ContactPage/WorkshopSearchPage.cshtml", new WorkshopPageViewModel(currentPage, garages)));
        }