コード例 #1
0
        public void GetAll_Returns_3_Dogs()
        {
            var underTest = new DogRepository();
            var result    = underTest.GetAll();

            Assert.Equal(3, result.Count);
        }
コード例 #2
0
        public ActionResult <IEnumerable <Pet> > GetAll()
        {
            IDogRepository dogRepository = new DogRepository();
            var            dogs          = dogRepository.GetAll();

            return(Ok(dogs));
        }
コード例 #3
0
        public IActionResult Get()
        {
            var dogs = dogRepository.GetAll().Select(dog => new ApiDog {
                Id   = dog.Id,
                Name = dog.Name
            });

            return(Ok(dogs)); // "OkResult" - 200 OK, with response body (automatically serialized).
        }
コード例 #4
0
ファイル: MapController.cs プロジェクト: AaronWGoh/Walkies
        public async Task <IActionResult> Index()
        {
            if (PasswordHash.userauth == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            IEnumerable <Shelter> shelters = await _shelterRepo.GetAll();

            IEnumerable <Dog> dogs = await _dogRepo.GetAll();

            ViewBag.userTypes = await _userTypeRepo.GetAll();

            DisplayData displayData = new DisplayData
            {
                Shelters  = shelters,
                Dogs      = dogs,
                City      = "Salt Lake City",
                StateCode = "UT"
            };

            return(View(displayData));
        }
コード例 #5
0
        public async Task <IActionResult> Doggos()
        {
            IEnumerable <Dog> dogs = await _dogRepo.GetAll();

            return(View(dogs));
        }
コード例 #6
0
        public IActionResult Index()
        {
            var dogs = _repository.GetAll();

            return(View(dogs));
        }