예제 #1
0
        public async Task <ProductResult> FindDetailAsync(IdRequestFilter <long> filter)
        {
            var product = await _productRepository.FindDetailAsync(filter);

            if (product == null)
            {
                return(null);
            }

            var pictures = await _productPictureRepository.GetProductPicturesByProductIdAsync(new IdRequestFilter <long>
            {
                Id              = filter.Id,
                CanGetDeleted   = filter.CanGetDeleted,
                CanGetInactived = filter.CanGetInactived
            });

            product.Pictures = pictures.Select(x => new PictureResult
            {
                Id = x.PictureId
            });

            product.ProductAttributes = await _productAttributeRepository.GetAttributeRelationsByProductIdAsync(filter.Id);

            product.CreatedBy = (await _userRepository.FindByIdAsync(product.CreatedById)).DisplayName;
            product.UpdatedBy = (await _userRepository.FindByIdAsync(product.CreatedById)).DisplayName;
            return(product);
        }