예제 #1
0
        public HttpResponseMessage UpdateUserDog([FromBody] DogDetailsView userDog)
        {
            try
            {
                dogValidator     userdogValidator = new dogValidator();
                ValidationResult results          = userdogValidator.Validate(userDog);

                if (results.IsValid)
                {
                    //var jsonString = userDogs.Content.ReadAsStringAsync().Result;
                    //DogsForManagerView list = JsonConvert.DeserializeObject<DogsForManagerView>(jsonString);
                    //  UserDetailsView user = JsonConvert.DeserializeObject<UserDetailsView>(jsonString);
                    Userservice userservice = new Userservice();
                    userservice.UpdateDog(userDog);

                    return(Request.CreateResponse(HttpStatusCode.OK));
                }

                else
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest));
                }
            }
            catch (HttpRequestException ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
                // throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest,
                //                           badInputValidationException.Result));
                //Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }
        }