public decimal GetPricing(int productId)
 {
     var productPrice = (from prodPrice in _dataContext.ProductPricings
                         where prodPrice.ProductId == productId
                         select prodPrice.Price).SingleOrDefault();
     var promotionRepository = new PromotionRepository();
     var isOnSale =
         (from pricing in _dataContext.ProductPricings
          where pricing.ProductId == productId
          select pricing.IsOnSale).FirstOrDefault();
     if (isOnSale)
     {
         productPrice = promotionRepository.GetPromotionPricing(productId, productPrice);
     }
     //var productPrice = (_dataContext.ProductPricings.Where(prodPrice => prodPrice.Id == productId).Select(prodPrice => prodPrice.Price)).SingleOrDefault();
     return productPrice;
 }
Ejemplo n.º 2
0
 public PromotionController()
 {
     _repository = new PromotionRepository();
 }