コード例 #1
0
        public HttpResponseMessage Post(Category newCategory)
        {
            var ops = new BlogPostOperations();

            ops.AddCategory(newCategory);

            var response = Request.CreateResponse(HttpStatusCode.Created, newCategory);

            string uri = Url.Link("DefaultApi", new { id = newCategory.CategoryID });

            response.Headers.Location = new Uri(uri);

            return(response);
        }