Exemplo n.º 1
0
        // the default void return type returns a View (Page in dotnet core) - the corresponding cshtml
        // required for Option 2:
        //public void OnGet(string searchTerm /*Input Model - Model Binding will bind it here from the query string / form data/ http headers */)
        public void OnGet()
        {
            LocalMessage    = "Hello, World";
            ExternalMessage = config["Message"];

            // Option 1: (no method parameter needed)
            //string resturantName = null;
            //if (HttpContext.Request.Query.ContainsKey("searchTerm")) ;
            //resturantName = HttpContext.Request.Query["searchTerm"];
            //Resturants = resturantData.GetResturantByName(resturantName);

            // Option 2:
            // Resturants = resturantData.GetResturantByName(searchTerm - a method param. in Option 3 we use a Property);

            // Option 3:
            Resturants = resturantData.GetResturantByName(SearchTerm);
        }