public void CreateNewPricePromotion()
        {
            var item        = A.New <PricePromotion>();
            var createdItem = _promotionService.AddPromotion(item);

            var storageItem = _promotionRepository.Select(createdItem.Id);

            Assert.NotNull(storageItem);
            Assert.True(storageItem is PricePromotion);
        }
Exemple #2
0
        private void ManagePromotion()
        {
            bool isExist = false;

            try
            {
                ConsoleHelper.CleanTheConsole(this.Description);
                while (isExist == false)
                {
                    ProductModel selectedProduct         = null;
                    var          inputProductCodeCommand = new ProductCommand(selectedProduct, ProductAction.InputProductCode);
                    inputProductCodeCommand.ExecuteAction();
                    selectedProduct = inputProductCodeCommand.Product;
                    if (selectedProduct != null)
                    {
                        isExist = selectedProduct.Code.Equals(CommonUtils.EXIT_STRING);
                    }
                    if (isExist == false)
                    {
                        PromotionModel = new PromotionModel();
                        InputPromotionType();
                        if (PromotionModel.PromotionTypeId == (int)PromotionTypeEnum.Buy_X_Give_Y)
                        {
                            InputQuantityDiscount();
                        }
                        else if (PromotionModel.PromotionTypeId == (int)PromotionTypeEnum.SaleOff_X_Percent)
                        {
                            InputPercentDiscount();
                        }
                        AddAdditionalDataToPromotion(selectedProduct);
                        promotionService.AddPromotion(PromotionModel);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public Result <BasePromotion> Post([FromBody] PricePromotion item)
 {
     return(_promotionService.AddPromotion(item));
 }
Exemple #4
0
 public void AddGame(Games games, Player player)
 {
     _promotionService.AddPromotion("20% discount available for you");
     _gameDal.Add(games);
     Console.WriteLine(player.PlayerName + " : " + games.GameName + " game added.");
 }
        public async Task <IActionResult> PostPromotion([FromBody] Promotion promotion)
        {
            await _promotionService.AddPromotion(promotion);

            return(CreatedAtAction("GetPromotion", new { id = promotion.promotionid }, promotion));
        }