public Review Update(Review Review) { using (var client = new HttpClient()) { HttpResponseMessage response = client.PutAsJsonAsync("http://localhost:17348/api/Review/" + Review.Id, Review).Result; return response.Content.ReadAsAsync<Review>().Result; } }
public void Delete(Review Review) { using (var client = new HttpClient()) { HttpResponseMessage response = client.DeleteAsync("http://localhost:17348/api/Review/" + Review.Id).Result; } }
public ActionResult AddReview(ReviewViewModel model) { Review review = new Review() { Title = model.review.Title, Text = model.review.Text }; int id = Convert.ToInt32(model.company.Id); Company company = facade.GetCompanyGateway().Find(id); List<Review> reviews = company.Reviews.ToList(); reviews.Add(review); company.Reviews = reviews; facade.GetReviewGateway().Add(review); facade.GetCompanyGateway().Update(company); return RedirectToAction(actionName: "Details", controllerName: "Company", routeValues: new { Id = id }); }