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

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

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

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

            return(View(dog));
        }
예제 #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));
            }
        }
예제 #5
0
        // 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));
            }
        }
예제 #6
0
        public string GetDogById(int DogId)
        {
            Dog    dog  = _dogRepository.GetDogById(DogId);
            string json = JsonConvert.SerializeObject(dog, Constants.JSON_FORMATTING_METHOD);

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

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