コード例 #1
0
        // Create a new Session
        // POST /api/recipes
        public HttpResponseMessage Post(Kitchenware kitchenware)
        {
            Uow.Kitchenwares.Add(kitchenware);
            Uow.Commit();

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

            // Compose location header that tells how to get this session
            // e.g. ~/api/session/5
            response.Headers.Location =
                new Uri(Url.Link(WebApiConfig.ControllerAndId, new { id = kitchenware.Id }));

            return response;
        }
コード例 #2
0
 // Update an existing Session
 // PUT /api/recipes/
 public HttpResponseMessage Put(Kitchenware kitchenware)
 {
     Uow.Kitchenwares.Update(kitchenware);
     Uow.Commit();
     return new HttpResponseMessage(HttpStatusCode.NoContent);
 }