public void OnGet()
 {
     if(SearchString == null)
     {
         products = cakeRepository.GetAllCakes();
     }
     else
     {
         products = cakeRepository.Search(SearchString);
     }     
 }
Beispiel #2
0
        public IHttpActionResult GetAllCakes()
        {
            var result = _repository.GetAllCakes();

            if (!result.Any())
            {
                return(NotFound());
            }

            return(Ok(result));
        }
Beispiel #3
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var cakes = _cakeRepository.GetAllCakes().OrderBy(c => c.Name);

            var homeViewModel = new HomeViewModel()
            {
                Title = "Custom Cake Delivery",
                Cakes = cakes.ToList()
            };

            return(View(homeViewModel));
        }
        public IActionResult Index()
        {
            var cakes = _cakeRepository.GetAllCakes().OrderBy(c => c.Name);

            var cakeViewModel = new CakeViewModel()
            {
                Cakes = cakes.ToList(),
                Title = "Welcome to our delicious cakes"
            };

            return(View(cakeViewModel));
        }
        public IActionResult Index()
        {
            var coffes = _coffeeRepository.GetAllCoffees();
            var cakes  = _cakeRepository.GetAllCakes();
            var drinks = _drinksRepository.GetAllDrinks();

            var adminViewModel = new AdminViewModel()
            {
                Coffees  = coffes.ToList(),
                Cakes    = cakes.ToList(),
                Drinkses = drinks.ToList()
            };

            return(View(adminViewModel));
        }