Ejemplo n.º 1
0
        public IActionResult Pets(Guid?id)
        {
            try
            {
                if (id == null)
                {
                    return(NotFound());
                }

                var pet = _petManager.GetPetByOwnerId(id);
                if (pet == null)
                {
                    return(NotFound());
                }

                return(View(pet));
            }
            catch (Exception ex)
            {
                if (ex is DataAccessException)
                {
                    return(StatusCode(StatusCodes.Status400BadRequest, "An error occurred while attempting to retreieve this resource."));
                }
                return(StatusCode(StatusCodes.Status500InternalServerError, "An unexpected error occurred while processing this request"));
            }
        }