public void Remove(OrderMovie ord) { using (var client = new HttpClient()) { HttpResponseMessage response = client.DeleteAsync(ServerAddress.Address + "ordermovie/" + ord.Id).Result; } }
public void Add(OrderMovie om) { using (var client = new HttpClient()) { HttpResponseMessage response = client.PostAsJsonAsync(ServerAddress.Address + "ordermovie/", om).Result; } }
public Movie GetMovieByOrderMovie(OrderMovie om) { using (var client = new HttpClient()) { HttpResponseMessage response = client.GetAsync(ServerAddress.Address + "MovieByOrderMovie?id="+ om.Id).Result; return response.Content.ReadAsAsync<Movie>().Result; } }
public ActionResult PlaceOrder(Customer cus) { if (cus.Id == 0) Facade.GetInstance().GetCustomerRep().Add(cus); Order order = new Order() { Customer = cus, Date = DateTime.Now, OrderMovie = new List<OrderMovie>() }; Facade.GetInstance().GetOrderRep().Add(order); foreach (var item in ShoppingCart.GetInstance().movies) { OrderMovie om = new OrderMovie() { Movie = item, Order = order }; Facade.GetInstance().GetOrderMovieRep().Add(om); } ShoppingCart.GetInstance().EmptyCart(); SetCart(); return View(); }