public ActionResult <ProductReview> CreateNewReview([FromBody] ProductReview productReview)
        {
            // Save in the dao
            dao.Add(productReview);

            // Return 201 (with a location header: https://localhost:44359/api/reviews/{id})
            // First parameter - Name of the route to generate for API
            // Second parameter - The variables for the route
            // Third parameter - The response body
            return(CreatedAtRoute("GetReviewById", new { id = productReview.Id }, productReview));
        }
Beispiel #2
0
 public ActionResult <Item> CreateNewItem([FromBody] Item newItem)
 {
     dao.Add(newItem);
     return(NoContent());
 }
 public ActionResult <ProductReview> CreateNewReview([FromBody] ProductReview productReview)
 {
     dao.Add(productReview);
     return(NoContent());
 }