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

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

            return(Ok(result));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }