Пример #1
0
        public ExecuteResult<ProductInfoResponse> CreateShare(CreateShareProductRequest request)
        {
            if (request == null)
            {
                return new ExecuteResult<ProductInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "参数错误" };
            }
            var product = _productRepository.GetItem(request.ProductId);
            if (product == null)
            {
                return new ExecuteResult<ProductInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "参数错误" };
            }

            _shareService.Create(new ShareHistoryEntity
            {
                CreatedDate = DateTime.Now,
                CreatedUser = request.AuthUid,
                Description = request.Description,
                Name = request.Name,
                ShareTo = (int)request.OsiteType,
                SourceId = request.ProductId,
                SourceType = (int)SourceType.Product,
                Stauts = 1,
                User_Id = request.AuthUid,
                UpdatedDate = DateTime.Now,
                UpdatedUser = request.AuthUid
            });

            //+1
            product = _productRepository.SetCount(ProductCountType.ShareCount, product.Id, 1);

            return new ExecuteResult<ProductInfoResponse>(MappingManager.ProductInfoResponseMapping(product));
        }
Пример #2
0
 public ActionResult Share(CreateShareProductRequest request, int? authuid, UserModel authUser)
 {
     request.AuthUid = authuid.Value;
     request.AuthUser = authUser;
     return new RestfulResult { Data = this._productDataService.CreateShare(request) };
 }