예제 #1
0
        public IActionResult Index()
        {
            var productViewModelList = new List <ProductInformationViewModel>();
            var products             = _productInformationService.GetAll();

            foreach (var product in products)
            {
                BatchInformation batchInfo = _batchInformationService.GetBatchInfoById(product.BatchId);
                productViewModelList.Add(new ProductInformationViewModel
                {
                    ProductId         = product.Id,
                    ProductCode       = product.ProductCode,
                    ProductName       = product.ProductName,
                    StockStatusName   = GetStockStatusDisplayName((int)product.StockType),
                    ProductStatusName = GetProductStatusDisplayName((int)product.ProductStatus),
                    ClassTypeName     = GetClassTypeDisplayName((int)product.Type),
                    StockStatusType   = product.StockType,
                    ProductStatusType = product.ProductStatus,
                    ClassType         = product.Type,
                    BatchId           = product.BatchId,
                    BatchName         = batchInfo.Name
                });
            }
            return(View(productViewModelList));
        }
        public ActionResult GetList()
        {
            var blResult = _productInformationService.GetAll();

            if (blResult.actionResult.ResultConnection != ServiceResult.ResultConnectionEnum.Correct)
            {
                _logger.LogError($"Product information service error: {blResult.actionResult.Message}");
                return(StatusCode(StatusCodes.Status500InternalServerError, blResult.actionResult.Message));
            }

            if (blResult.productInformations != null && blResult.productInformations.Count == 0)
            {
                return(StatusCode(StatusCodes.Status404NotFound, "Product informations do not exist"));
            }

            return(Ok(blResult.productInformations));
        }
예제 #3
0
        /// <summary>
        /// 商品页面
        /// </summary>
        /// <returns></returns>
        public IActionResult QueryProductList()
        {
            var productViewModelList = new List <ProductInformationViewModel>();
            var products             = _productInformationService.GetAll();

            foreach (var product in products)
            {
                BatchInformation batchInfo = _batchInformationService.GetBatchInfoById(product.BatchId);
                productViewModelList.Add(new ProductInformationViewModel
                {
                    ProductId         = product.Id,
                    ProductCode       = product.ProductCode,
                    ProductName       = product.ProductName,
                    StockStatusType   = product.StockType,
                    ProductStatusType = product.ProductStatus,
                    ClassType         = product.Type,
                    BatchId           = product.BatchId,
                    BatchName         = batchInfo != null?batchInfo.Name:string.Empty
                });
            }
            return(View(productViewModelList));
        }