示例#1
0
        public void Order_DetailsRepositoryTests_Update()
        {
            Order_DetailsRepository repository = new Order_DetailsRepository();
            var model = new Order_Details
            {
                Order_Details_ID = 13,
                Order_ID         = 6,
                Product_ID       = 2,
                Quantity         = 2,
                Price            = 150,
                Discount         = 0,
                size             = "X"
            };

            repository.Update(model);
            var result = repository.GetByOrder_Details_ID(13);

            Assert.IsTrue(result.Quantity == 2);
        }
示例#2
0
 public bool UpdateOrderDetail(Person_OrderDetail person_OrderDetail)
 {
     try
     {
         var products = RepositoryContainer.GetInstance <ProductsRepository>().GetByProduct_ID(person_OrderDetail.Product_ID);
         Order_DetailsRepository.Update(new Models.Order_Details {
             Order_Details_ID = person_OrderDetail.Order_Details_ID,
             Color            = person_OrderDetail.Color,
             Product_ID       = person_OrderDetail.Product_ID,
             Price            = products.UnitPrice * person_OrderDetail.Quantity,
             Quantity         = person_OrderDetail.Quantity,
             size             = person_OrderDetail.size,
         });
         var order_ID = Order_DetailsRepository.GetByOrder_Details_ID(person_OrderDetail.Order_Details_ID).Order_ID;
         var o        = RepositoryContainer.GetInstance <OrdersRepository>();
         o.UpdateTotalMoney(order_ID);
         return(true);
     }
     catch
     {
         return(false);
     }
 }