public void Test_Getters_And_Setters()
        {
            List<Orderline> orderlines = new List<Orderline>();
            Orderline OL1= new Orderline() {OrderId = 2, MovieId = 6, Amount = 6, Price = 30};
            Orderline Ol2= new Orderline() {OrderId = 2, MovieId = 17, Amount = 8, Price = 30};
            orderlines.Add(Ol2);
            orderlines.Add(OL1);
            Customer cust = new Customer()
            {
                Id = 1,
                FirstName = "Someone",
                MiddleName = "Else",
                LastName = "Name",
                Email = "*****@*****.**",
                StreetName = "Bla Vej",
                StreetNumber = 1,
                Password = "******"
            };
            Status stat = new Status() { Id = 1, Name = "Shipped" };
            Order Ord = new Order() {Id=1,Orderlines = orderlines, Customer = cust, OrderDate = DateTime.Now.Date, Status = stat};

            Ord.Id = 1;
            Ord.Orderlines = orderlines;
            Ord.Customer = cust;
            Ord.OrderDate=DateTime.Now.Date;
            Ord.Status = stat;

            Assert.AreEqual(Ord.Id,1);
            Assert.AreEqual(Ord.Orderlines,orderlines);
            Assert.AreEqual(Ord.Customer,cust);
            Assert.AreEqual(Ord.OrderDate, DateTime.Now.Date);
            Assert.AreEqual(Ord.Status,stat);
        }
        public void Test_Constructor()
        {
            List<Orderline> orderlines = new List<Orderline>();
            Orderline OL1 = new Orderline() { OrderId = 2, MovieId = 6, Amount = 6, Price = 30 };
            Orderline Ol2 = new Orderline() { OrderId = 2, MovieId = 17, Amount = 8, Price = 30 };
            orderlines.Add(Ol2);
            orderlines.Add(OL1);
            Customer cust = new Customer()
            {
                Id = 1,
                FirstName = "Someone",
                MiddleName = "Else",
                LastName = "Name",
                Email = "*****@*****.**",
                StreetName = "Bla Vej",
                StreetNumber = 1,
                Password = "******"
            };

            Order Ord = new Order(orderlines, cust);

            Assert.NotNull(Ord);
            Assert.NotNull(orderlines);
            Assert.NotNull(cust);
        }
 public ActionResult Index(Order order)
 {
     if (ModelState.IsValid)
     {
         return View();
     }
     return View();
 }
 /// <summary>
 /// Adds a genre to the database
 /// </summary>
 /// <param name="ord">the order to be added</param>
 public void Add(Order ord)
 {
     using (var ctx = new MovieShopContext())
     {
         ctx.Orders.Add(ord);
         ctx.SaveChanges();
     }
 }
        /// <summary>
        /// sends an order to the web api, that will then be added to the Database
        /// </summary>
        /// <param name="item">the order to be added</param>
        /// <returns>The order with the correct primary key</returns>
        public override Order Add(Order item)
        {
            using (var httpClient = new HttpClient())
            {
                var result = httpClient.PostAsJsonAsync(ORDER_END_POINT, item).Result;

                return JsonConvert.DeserializeObject<Order>(result.Content.ReadAsStringAsync().Result);
            }
        }
        public ActionResult Purchase()
        {
            ShoppingCart cart = GetCart();

            for (int i = 0; i < cart.Orderline.Count; i++)
            {
                cart.Orderline[i].MovieId = cart.Orderline[i].Movie.Id;
                cart.Orderline[i].Price = cart.Orderline[i].Movie.Price;
            }

            Order order = new Order(cart.Orderline, User.Identity.Name);
            facade.GetOrderGateway().Add(order);

            cart.Orderline = new List<Orderline>();

            return View("Success");
        }