public ActionResult EditDogDisplay(int?DogID)
        {
            if (DogID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else
            {
                var dogForEdit = dogService.GetDog((int)DogID);

                return(PartialView(dogForEdit));
            }
        }
Exemple #2
0
 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);
        }
Exemple #4
0
        public ActionResult <DogDto> GetDog([FromRoute] int dogId)
        {
            var dto = _dogService.GetDog(dogId);

            if (dto == null)
            {
                return(NotFound());
            }
            return(Ok(dto));
        }
Exemple #5
0
        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());
            }
        }
Exemple #6
0
        public IActionResult GetDog([FromRoute] string breed)
        {
            var result = _dogService.GetDog(breed);

            return(Ok(result));
        }