Ejemplo n.º 1
0
        public ActionResult <Dog> Post(Dog dog)
        {
            if (dog == null || string.IsNullOrEmpty(dog.Name) || dog.Weight < 0 || dog.Age < 0)
            {
                return(BadRequest());
            }

            dog.Photo = _dogApiService.GetImage();
            try
            {
                _dogService.PostDog(dog);
            }
            catch (Exception)
            {
                return(StatusCode(500));
            }
            return(Created(nameof(Post), dog));
        }