예제 #1
0
        static void RunPriceManagementProcess()
        {
            NewPriceModel   model    = new NewPriceModel();
            ICommandHandler handler  = new CommandHandler();
            PriceCommand    priceCmd = new PriceCommand(model, ConsoleApp.Action.PriceAction.AddNewPrice);

            CommonUtils.ExecuteCommand(handler, priceCmd);
        }
예제 #2
0
        private void ShowAndUpdatePrice(ProductModel selectedProduct)
        {
            Console.WriteLine($"Current Price: {selectedProduct.Price}/{selectedProduct.Measure}");
            double newPriceInput = this.InputNewPrice();

            this.PriceModel = new NewPriceModel
            {
                ProductId = selectedProduct.Id,
                Price     = newPriceInput,
                ApplyDate = DateTime.Now,
                IsActive  = true
            };
            priceService.AddNewPrice(PriceModel);
        }
예제 #3
0
 public void AddNewPrice(NewPriceModel priceModel)
 {
     try
     {
         var newPrice = new Entity.Price
         {
             ProductId = priceModel.ProductId,
             Value     = priceModel.Price,
             ApplyDate = priceModel.ApplyDate,
             IsActive  = priceModel.IsActive
         };
         priceRepository.Insert(newPrice);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public PriceCommand(NewPriceModel model, PriceAction priceAction)
 {
     this.priceAction = priceAction;
     this.PriceModel  = model;
     priceService     = new PriceService();
 }