public void Edit(int id, OrderDetail orderDetail)
        {
            var productPricingRepository = new ProductPricingRepository();
            OrderDetail entityToEdit = (from cust in _dataContext.OrderDetails
                                        where cust.Id == id
                                        select cust).FirstOrDefault();

            entityToEdit.ProductId = orderDetail.ProductId;
            entityToEdit.Quantity = orderDetail.Quantity;
            entityToEdit.UnitPrice = productPricingRepository.GetPricing(orderDetail.ProductId);
            entityToEdit.ModifiedDate = DateTime.Now;

            _dataContext.SaveChanges();
        }
        public void Add(int orderId, OrderDetail orderDetail)
        {
            var productPricingRepository = new ProductPricingRepository();

            var addr = new OrderDetail
                           {
                               OrderId = orderId,
                               ProductId = orderDetail.ProductId,
                               Quantity = orderDetail.Quantity,
                               UnitPrice = productPricingRepository.GetPricing(orderDetail.ProductId),
                               ModifiedDate = DateTime.Now
                           };

            _dataContext.OrderDetails.AddObject(addr);
            _dataContext.SaveChanges();
        }
 public ProductPricingController()
 {
     _repository = new ProductPricingRepository();
 }