예제 #1
0
        public IHttpActionResult PutProduct(int id, Product product)
        {
            performAdditionalValidation(ModelState, product);
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                return(Ok(repository.update(product, id)));
            }
            catch (Exception e)
            {
                return(NotFound());
            }
        }
예제 #2
0
        public IHttpActionResult PutAuthor(int id, Author author)
        {
            performAdditionalValidation(ModelState, author);
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                return(Ok(authorRepository.update(author, id)));
            }
            catch (Exception e)
            {
                return(NotFound());
            }
        }