// Create a new Session // POST /api/recipes public HttpResponseMessage Post(Ingredient ingredient) { Uow.Ingredients.Add(ingredient); Uow.Commit(); var response = Request.CreateResponse(HttpStatusCode.Created, ingredient); // 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 = ingredient.Id })); return response; }
// Update an existing Session // PUT /api/recipes/ public HttpResponseMessage Put(Ingredient ingredient) { Uow.Ingredients.Update(ingredient); Uow.Commit(); return new HttpResponseMessage(HttpStatusCode.NoContent); }