public void TestGetDogById() { var result = _dogRepository.GetDogById(1); var expected = _dogs[0]; Assert.AreEqual(expected, result); }
// GET: DogsController/Details/5 public ActionResult Details(int id) { Dog dog = _dogRepo.GetDogById(id); if (dog == null) { return(NotFound()); } return(View(dog)); }
public ActionResult Edit(int id) { int ownerId = GetCurrentUserId(); Dog dog = _dogRepo.GetDogById(id); if (dog.OwnerId != ownerId) { return(NotFound()); } return(View(dog)); }
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)); } }
public string GetDogById(int DogId) { Dog dog = _dogRepository.GetDogById(DogId); string json = JsonConvert.SerializeObject(dog, Constants.JSON_FORMATTING_METHOD); return(json); }
// GET: DogController/Details/5 public ActionResult Details(int id) { Dog dog = _dogRepo.GetDogById(id); return(View(dog)); }
public DogModel GetDogById(DogId dogId) { return(_dogRepository.GetDogById(dogId)); }