コード例 #1
0
ファイル: BullyDogController.cs プロジェクト: Magnona/Breeder
        /*
         * //
         * // GET: /ShoppingCart/
         * public async Task<IActionResult> GetPetInfo(int id)
         * {
         *  var cart = ShoppingCart.GetCart(DbContext, HttpContext);
         *
         *  // Set up our ViewModel
         *  var viewModel = new ShoppingCartViewModel
         *  {
         *      CartItems = await cart.GetCartItems(),
         *      CartTotal = await cart.GetTotal()
         *  };
         *
         *  // Return the view
         *  return View("Detail",viewModel);
         * }
         *
         *
         * //
         * // GET: /ShoppingCart/AddToCart/5
         */
        //BullyDog/GetPetInfo/1
        public IActionResult GetPetInfo(int id)
        {
            var model = new BullyDogViewModel();

            model.Pets        = GetAllPets();
            model.SelectedPet = model.Pets.FirstOrDefault(pet => pet.Name == "Dog 3");
            return(View("Detail", model));
        }
コード例 #2
0
ファイル: BullyDogController.cs プロジェクト: Magnona/Breeder
        public IActionResult AdultDog()
        {
            var model = new BullyDogViewModel();

            model.Pets        = GetAllPets().Where(x => x.IsAdult).ToList();
            model.SelectedPet = model.Pets.FirstOrDefault(pet => pet.Name == "Dog 3");
            model.Title       = "Available Dogs";
            return(View("BullyDog", model));
        }