/// <summary>
        /// Fills Restaurant entries in list from server request. 
        /// </summary>
        public RestaurantList GetRestaurantList(string postCode)
        {
            string respose = GetApiResponse("/restaurants/", "?q=" + postCode);

            _restaurantList = JsonConvert.DeserializeObject<RestaurantList>(respose);

            // sort list of restaurants by average rating
            _restaurantList.Restaurants = _restaurantList.Restaurants.OrderByDescending(r => r.RatingStars).ToList();

            return _restaurantList ;
        }
Beispiel #2
0
        public ActionResult Index(FormCollection form)
        {
            try
            {
                string postCode = form["postCode"];

                this._restaurantList = _apiProcessor.GetRestaurantList(postCode);
                return View(_restaurantList);
            }
            catch (Exception ex)
            {
                return View(model:null);
            }
        }
 public RestaurantList GetAll()
 {
     _restaurantList = _apiResonseProcessor.GetRestaurantList(postCode: "se24");
     return _restaurantList;
 }