Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult City(string id)
        {
            RestaurantDomainLogic restaurantDomainLogic = new RestaurantDomainLogic();
            CommonDomainLogic     _commonDomainLogic    = new CommonDomainLogic();
            ChooseCity            chooseCity            = new ChooseCity();

            if (!string.IsNullOrEmpty(id))
            {
                Guid            _cityguid        = _commonDomainLogic.FindCityGuid(id);
                UserDomainLogic _userDomainLogic = new UserDomainLogic();
                _userDomainLogic.UpdatePreferedCity(_cityguid);
                chooseCity.Cities       = _commonDomainLogic.GetCityByGUID(_cityguid);
                chooseCity.SelectedCity = new City {
                    CityName = chooseCity.Cities.FirstOrDefault().CityName, CityGuid = chooseCity.Cities.FirstOrDefault().CityGuid, CityUrlName = chooseCity.Cities.FirstOrDefault().CityUrlName
                };
            }
            else
            {
                chooseCity.Cities       = _commonDomainLogic.GetCities();
                chooseCity.SelectedCity = new City {
                    CityName = chooseCity.Cities.FirstOrDefault().CityName, CityGuid = chooseCity.Cities.FirstOrDefault().CityGuid, CityUrlName = chooseCity.Cities.FirstOrDefault().CityUrlName
                };
            }

            return(View("ListRestaurants", restaurantDomainLogic.GetRestaurantsByCity(chooseCity.SelectedCity)));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CityGuid"></param>
        /// <returns></returns>
        public ActionResult UpdatePreferedCity(Guid CityGuid)
        {
            UserDomainLogic userDomainLogic = new UserDomainLogic();

            userDomainLogic.UpdatePreferedCity(CityGuid);
            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <param name="BusinessTypeGuid"></param>
        /// <param name="LocationGuid"></param>
        /// <returns></returns>
        public ActionResult LocationListUser(string id, Nullable <Guid> BusinessTypeGuid, Nullable <Guid> LocationGuid)
        {
            BusinessDomainLogic businessDomainLogic = new BusinessDomainLogic();
            CommonDomainLogic   _commonDomainLogic  = new CommonDomainLogic();
            ChooseCity          chooseCity          = new ChooseCity();

            TempData["SelectedBusinessTypeGuid"] = BusinessTypeGuid;
            if (!string.IsNullOrEmpty(id))
            {
                Guid            _cityguid        = _commonDomainLogic.FindCityGuid(id);
                UserDomainLogic _userDomainLogic = new UserDomainLogic();
                _userDomainLogic.UpdatePreferedCity(_cityguid);
                chooseCity.Cities       = _commonDomainLogic.GetCityByGUID(_cityguid);
                chooseCity.SelectedCity = new City {
                    CityName = chooseCity.Cities.FirstOrDefault().CityName, CityGuid = chooseCity.Cities.FirstOrDefault().CityGuid, CityUrlName = chooseCity.Cities.FirstOrDefault().CityUrlName
                };
            }
            else
            {
                UserDomainLogic userDomainLogic = new UserDomainLogic();
                string          guid            = userDomainLogic.FindUser(UserVariables.LoggedInUserGuid).PreferedCity;
                if (!string.IsNullOrEmpty(guid))
                {
                    chooseCity.Cities = _commonDomainLogic.GetCityByGUID(new Guid(guid));
                }
                else
                {
                    chooseCity.Cities = _commonDomainLogic.GetCities();
                }

                chooseCity.SelectedCity = new City {
                    CityName = chooseCity.Cities.FirstOrDefault().CityName, CityGuid = chooseCity.Cities.FirstOrDefault().CityGuid, CityUrlName = chooseCity.Cities.FirstOrDefault().CityUrlName
                };
            }

            int Currentpage = 0;

            TempData["CurrentPage"] = null;
            if (LocationGuid == null || LocationGuid == Guid.Empty)
            {
                if (Request.Url.AbsoluteUri.Contains('?') && Request.Url.AbsoluteUri.Contains("page"))
                {
                    TempData["CurrentPage"] = Request.Url.AbsoluteUri.Split('&')[1].Split('=')[1].Split('&')[0];
                    Currentpage             = TempData["CurrentPage"] == null ? 0 : Convert.ToInt32(TempData["CurrentPage"]);
                    TempData.Keep();
                }
            }

            return(View(businessDomainLogic.GetBusinessByCity(chooseCity.SelectedCity, BusinessTypeGuid, Currentpage)));
        }