public ActionResult EditDogDisplay(int?DogID) { if (DogID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { var dogForEdit = dogService.GetDog((int)DogID); return(PartialView(dogForEdit)); } }
public ActionResult <Dog> Get(string id) { if (string.IsNullOrEmpty(id)) { return(BadRequest()); } try { return(_dogService.GetDog(id)); } catch (Exception) { return(StatusCode(404)); } }
public async Task <DogViewModel> GetDogViewModel() { var result = await _dogService.GetDog(); var viewModel = new DogViewModel(); viewModel.ImageUrl = result.Message; return(viewModel); }
public ActionResult <DogDto> GetDog([FromRoute] int dogId) { var dto = _dogService.GetDog(dogId); if (dto == null) { return(NotFound()); } return(Ok(dto)); }
public async Task <ActionResult <Dog> > Get(int id) { Dog dog = await _service.GetDog(id); if (dog == null) { return(NotFound()); } // return dog if requester is dog owner, else return unauthorized if (dog.OwnerId == GetUserId()) { return(Ok(dog)); } else { return(Unauthorized()); } }
public IActionResult GetDog([FromRoute] string breed) { var result = _dogService.GetDog(breed); return(Ok(result)); }