Пример #1
0
 public void Update(Order ord)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.PutAsJsonAsync(ServerAddress.Address + "order/", ord).Result;
     }
 }
Пример #2
0
 public void Remove(Order ord)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.DeleteAsync(ServerAddress.Address + "order/" + ord.Id).Result;
     }
 }
Пример #3
0
 public List<Movie> GetMovieByOrder(Order ord)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.GetAsync(ServerAddress.Address + "MoviesByOrder?id=" + ord.Id).Result;
         return response.Content.ReadAsAsync<List<Movie>>().Result;
     }
 }
Пример #4
0
 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();
 }