public ActionResult OnGet() { if (!User.Identity.IsAuthenticated) { return(RedirectToPage("/Account/Login", new { area = "Identity" })); } try { string cs = _config.GetConnectionString("Default"); Restaurants = fd.GetRestaurantList(cs); var foodtypes = fd.GetFoodTypeList(cs); var when = fd.GetWhenList(cs); FoodType = new List <SelectListItem>(); When = new List <SelectListItem>(); foodtypes.ForEach(x => { FoodType.Add(new SelectListItem { Value = x.FoodTypeID.ToString(), Text = x.FoodTypeText }); }); when.ForEach(x => { When.Add(new SelectListItem { Value = x.WhenID.ToString(), Text = x.WhenText }); }); RandomRestaurant = fd.GetRandomRestaurant(cs); return(Page()); } catch (Exception ex) { throw new Exception(ex.ToString()); } }