Beispiel #1
0
        public bool TryChangeOperatingModel(int sellerId, int productTypeId, OperatingModel model, out ICollection <string> errors)
        {
            errors = new List <string>();

            //check product null
            Product product = sellerRepository.GetProductBy(sellerId, productTypeId);

            if (product == null)
            {
                errors.Add("Could not found product");
                return(false);
            }

            OperatingModelService recentModelService      = modelServiceFactory.GetService(product.Model);
            OperatingModelService alternativeModelService = modelServiceFactory.GetService(model);

            if (!recentModelService.CanLeaveThisModel(product, out errors))
            {
                return(false);
            }

            if (!alternativeModelService.CanChangeToThisModel(product, out errors))
            {
                return(false);
            }
            else
            {
                product.Model = model;
                return(true);
            }
        }
 private void Handshake_OnOperatingModel(OperatingModel operatingModel)
 {
     this.OperatingModel = operatingModel;
 }
 public OperatingModelService(OperatingModel serviceOperatingModel, ISellerRepository sellerRepository)
 {
     this.sellerRepository = sellerRepository;
     ServiceOperatingModel = serviceOperatingModel;
 }