Пример #1
0
        public IActionResult Index()
        {
            var model = new HomeIndexViewModel {
                Restaurants = _restaurantService.GetAll().ToList()
            };

            return(View(model));
        }
Пример #2
0
        // GET: /Restaurant/List?QueryString...
        // public void OnGet(string searchRest)
        public void OnGet()
        {
            // One more way to access form data can be using HttpContext
            // To find something in request particularly- Form inputs, QueryString parameter, HTTP header

            // One we used is Model Binding (Note: <input>'s name attribute must match the parameter name
            // TAKE CARE of case when there is no query string then this parameter can raise an exception

            // SearchRest = searchRest;     // First way to bind input property instead of using BindProperty attribute

            Message     = config["Message"];
            Restaurants = restaurantData.GetAll();

            RestaurantsByName = restaurantData.GetRestaurantsByName(SearchRest);
        }
        // GET: Restaurants
        public ActionResult Index()
        {
            if (TempData["Pesan"] != null)
            {
                ViewData["Pesan"] = TempData["Pesan"];
            }
            else
            {
                ViewData["Pesan"] = "";
            }

            var models = _resto.GetAll();

            ViewBag.Nama       = "Erick";
            ViewData["Alamat"] = "Jl Duren 12, Yogyakarta";

            return(View(models));
        }
Пример #4
0
        public async Task <IEnumerable <Restaurant> > Get()
        {
            var models = await _resto.GetAll();

            return(models);
        }
Пример #5
0
        public ActionResult Index()
        {
            var model = restaurant.GetAll();

            return(View(model));
        }
        public async Task <IActionResult> GetData()
        {
            var models = await _restaurant.GetAll();

            return(new JsonResult(models));
        }