コード例 #1
0
        /// <summary>
        /// 添加产品
        /// </summary>
        /// <param name="request"></param>
        public void AddProduct(AddSupplierProductRequest request)
        {
            Supplier model = this._supplierRepository.FindBy(request.SupplierId);

            if (model == null)
            {
                throw new EntityIsInvalidException <string>(request.SupplierId.ToString());
            }
            Users createUser = this._usersRepository.FindBy(request.CreateUserId);

            if (createUser == null)
            {
                throw new EntityIsInvalidException <string>(request.CreateUserId.ToString());
            }
            Product product = this._productRepository.FindBy(request.ProductId);

            if (model == null)
            {
                throw new EntityIsInvalidException <string>(request.ProductId.ToString());
            }

            SupplierProduct p = new SupplierProduct(model, product, request.Price, createUser);

            this._supplierRepository.Add(model);
            this._uow.Commit();
        }
コード例 #2
0
        public void AddSupplierProduct(AddSupplierProductRequest request)
        {
            SupplierProduct model = this._supplierProductRepository.FindBy(request.Id);

            if (model == null)
            {
                throw new EntityIsInvalidException <string>(request.Id.ToString());
            }
            this._supplierProductRepository.Add(model);
            this._uow.Commit();
        }