Ejemplo n.º 1
0
        public ViewResult List()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            ViewBag.CurrentCategory = "Cheese cakes";
            return(View(pieListViewModel));
        }
Ejemplo n.º 2
0
 public PieListViewModel BuildViewModel(PieListViewModel viewModel)
 {
     _viewModel       = viewModel;
     _viewModel.Title = "Welcome to the Pie Shop";
     _viewModel.Pies  = _pieService.GetAllPies();
     return(_viewModel);
 }
Ejemplo n.º 3
0
        public ViewResult List()
        {
            var pieListViewModel = new PieListViewModel();//todo use automapper

            pieListViewModel.CurrentCategory = "Cheese cakes";
            pieListViewModel.Pies            = _pieRepository.Pies;
            return(View(pieListViewModel));
        }
Ejemplo n.º 4
0
        //ActionMethods
        public ViewResult List()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            pieListViewModel.Pies            = _pieRepository.AllPies;
            pieListViewModel.CurrentCategory = "Cheese Cakes";
            return(View(pieListViewModel));
        }
Ejemplo n.º 5
0
        public ViewResult List()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            pieListViewModel.Pies            = _pieRepo.AllPies;
            pieListViewModel.CurrentCategory = "Fruit Pies";
            return(View(pieListViewModel));
        }
Ejemplo n.º 6
0
        public ViewResult List()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            pieListViewModel.Pies = _pieRepository.Pies;

            return(View(pieListViewModel));
        }
Ejemplo n.º 7
0
        public IActionResult List()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            pieListViewModel.Pies            = _pieRepository.Pies;
            pieListViewModel.CurrentCategory = "cheese cake";
            return(View(pieListViewModel));
        }
Ejemplo n.º 8
0
        public ViewResult List()
        {
            var pieListVm = new PieListViewModel();

            pieListVm.Pies            = _pieRepository.Pies;
            pieListVm.CurrentCategory = "Cheese Cake";
            return(View(pieListVm));
        }
        public IActionResult Index()
        {
            var viewModel    = new PieListViewModel();
            var viewModelMgr = new PieListViewModelManager(_pieService);

            viewModel = viewModelMgr.BuildViewModel(viewModel);
            return(View(viewModel));
        }
Ejemplo n.º 10
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            pieListViewModel.CurrentCategory = "All the pies we got";
            pieListViewModel.Pies            = _pieRepository.GetPies();

            return(View(pieListViewModel));
        }
Ejemplo n.º 11
0
        public IActionResult Index()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            //pass data from pie repository to viewModel
            pieListViewModel.Pies            = _pieRepository.AllPies;
            pieListViewModel.CurrentCategory = "Cheese Cakes";
            return(View(pieListViewModel));
        }
Ejemplo n.º 12
0
        public ViewResult List()
        {
            ViewBag.Author = "Dhanushka Sandaruwan 2018/03/21";
            PieListViewModel piesListViewModel = new PieListViewModel();

            piesListViewModel.Pies            = _pieRepository.Pies;
            piesListViewModel.CurrentCategory = "Cheese Cakes";
            return(View(piesListViewModel));
        }
Ejemplo n.º 13
0
        public ViewResult List()
        {
            PieListViewModel pieList = new PieListViewModel();

            pieList.ListOfPies      = _pieRepository.AllPies();
            pieList.CurrentCategory = "Cheese cakes";

            return(View(pieList));
        }
Ejemplo n.º 14
0
        public ViewResult List()
        {
            //Create a ViewModel called PieListViewModel which can be use to collect data to transfer to view page
            PieListViewModel pieListViewModel = new PieListViewModel();

            pieListViewModel.Pies            = _pieRepository.AllPies;
            pieListViewModel.CurrentCategory = "Pies";
            return(View(pieListViewModel));
        }
Ejemplo n.º 15
0
        public IActionResult List()
        {
            // ViewBag.CurrentCategory = "Cheese cakes";
            PieListViewModel pieVM = new PieListViewModel();

            pieVM.Pies           = _pieRepository.AllPies;
            pieVM.CurentCategory = "Cheese cakes";

            return(View(pieVM));
        }
Ejemplo n.º 16
0
        public async Task <ViewResult> ListAsync()
        {
            PieListViewModel pieListViewModel = new PieListViewModel
            {
                Pies            = await _pieRepository.GetAllAsync(),
                CurrentCategory = "Pies"
            };

            return(View(pieListViewModel));
        }
Ejemplo n.º 17
0
        public ActionResult List()
        {
            var data = new PieListViewModel()
            {
                Pies             = _iPieRepository.GetPies(),
                SelectedCategory = "SOME SELECTED CATEGORY"
            };

            return(View(data));
        }
Ejemplo n.º 18
0
        public ViewResult List()
        {
            var pieListViewModel = new PieListViewModel
            {
                Pies            = _pieRepository.Pies,
                CurrentCategory = "Cheese cakes"
            };

            return(View(pieListViewModel));
        }
Ejemplo n.º 19
0
        public IActionResult List()
        {
            var viewModel = new PieListViewModel()
            {
                Title = "Welcome to the Pie Shop",
                Pies  = _pieRepository.Pies
            };

            return(View(viewModel));
        }
Ejemplo n.º 20
0
        /*  public IActionResult Index()
         * {
         *    return View();
         * }*/

        public ViewResult List()
        {
            PieListViewModel _pieListViewModel = new PieListViewModel();

            _pieListViewModel.Pies            = _pieRepository.AllPies;
            _pieListViewModel.CurrentCategory = "Cheese Cakes";
            //ViewBag.CurrentTite = "Cheese Cakes";
            //return View(_pieRepository.AllPies);
            return(View(_pieListViewModel));
        }
        public ViewResult List()
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            pieListViewModel.Pies            = _pieRepository.AllPies;
            pieListViewModel.CurrentCategory = "Cheese Cakes";

            //ViewBag.CurrentCategory = "Cheese cakes";  --DO NOT USE ViewBag!!!!! ViewModel should be created instead!
            //return View(_pieRepository.AllPies);

            return(View(pieListViewModel));
        }
Ejemplo n.º 22
0
        // because I want to return a list of pie.
        //There will be a rendering file in /Views/Pie/ called list.cshtml(razor page)
        // corresponding to this function.
        public ViewResult List()
        {
            // for one specific type:
            //ViewBag.CurrentCategory = "Cheese cakes";

            // By using ViewModel:
            PieListViewModel _pieListViewModel = new PieListViewModel();

            _pieListViewModel.Pies            = _pieRepository.AllPies;
            _pieListViewModel.CurrentCategory = "Cheese cakes";
            return(View(_pieListViewModel));
        }
Ejemplo n.º 23
0
        //public ViewResult List()
        //{
        //    PieListViewModel pieListViewModel = new PieListViewModel();

        //    pieListViewModel.Pies = _pieRepository.AllPies;
        //    pieListViewModel.CurrentCategory = "Chees cakes";

        //    return View(pieListViewModel);
        //}

        public ViewResult List(string category)
        {
            PieListViewModel pieListViewModel = new PieListViewModel();

            if (category != null)
            {
                pieListViewModel.Pies            = _pieRepository.AllPies.Where(p => p.Category.CategoryName == category);
                pieListViewModel.CurrentCategory = category;
            }
            else
            {
                pieListViewModel.Pies            = _pieRepository.AllPies;
                pieListViewModel.CurrentCategory = "All Pies";
            }

            return(View(pieListViewModel));
        }
Ejemplo n.º 24
0
        public IActionResult List(string category)
        {
            var result = new PieListViewModel();

            if (category == null)
            {
                result.Pies            = _pieRepos.Pies;
                result.CurrentCategory = "all";
            }
            else
            {
                result.Pies            = _pieRepos.PiesWithCategory(category);
                result.CurrentCategory = category;
            }


            return(View(result));
        }