public void TestGetDogById()
        {
            var result   = _dogRepository.GetDogById(1);
            var expected = _dogs[0];

            Assert.AreEqual(expected, result);
        }
Exemple #2
0
        // GET: DogsController/Details/5
        public ActionResult Details(int id)
        {
            Dog dog = _dogRepo.GetDogById(id);

            if (dog == null)
            {
                return(NotFound());
            }
            return(View(dog));
        }
Exemple #3
0
        public ActionResult Edit(int id)
        {
            int ownerId = GetCurrentUserId();
            Dog dog     = _dogRepo.GetDogById(id);

            if (dog.OwnerId != ownerId)
            {
                return(NotFound());
            }

            return(View(dog));
        }
Exemple #4
0
        public ActionResult Edit(int id)
        {
            Dog dog           = _dogRepo.GetDogById(id);
            int currentUserId = GetCurrentUserId();

            if (dog == null || dog.OwnerId != currentUserId)
            {
                return(NotFound());
            }
            else
            {
                return(View(dog));
            }
        }
        // GET: DogController/Details/5
        public ActionResult Details(int id)
        {
            Dog dog     = _dogRepository.GetDogById(id);
            int ownerId = GetCurrentUserId();

            if (dog.OwnerId != ownerId)
            {
                return(NotFound());
            }
            else
            {
                return(View(dog));
            }
        }
Exemple #6
0
        public string GetDogById(int DogId)
        {
            Dog    dog  = _dogRepository.GetDogById(DogId);
            string json = JsonConvert.SerializeObject(dog, Constants.JSON_FORMATTING_METHOD);

            return(json);
        }
Exemple #7
0
        // GET: DogController/Details/5
        public ActionResult Details(int id)
        {
            Dog dog = _dogRepo.GetDogById(id);

            return(View(dog));
        }
Exemple #8
0
 public DogModel GetDogById(DogId dogId)
 {
     return(_dogRepository.GetDogById(dogId));
 }