Exemple #1
0
        protected List <ProductInfoResult> GetProductCodeInfo()
        {
            var product = db.product_list().ToList();
            List <ProductInfoResult> productCodes = new List <ProductInfoResult>();

            foreach (var item in product)
            {
                productCodes.Add(new ProductInfoResult()
                {
                    id           = item.Id,
                    code         = item.PCode,
                    name         = item.PName,
                    barcode      = item.Barcode,
                    groupId      = item.GroupId,
                    groupName    = item.GroupName,
                    image        = HaiUtil.HostName + item.Thumbnail,
                    price        = item.Price == null ? 0 : item.Price,
                    quantity_box = item.QuantityBox == null ? 0 : item.QuantityBox,
                    quantity     = item.Quantity == null ? 0 : item.Quantity,
                    unit         = item.Unit,
                    vat          = item.PVat == null ? 0 : item.PVat
                });
            }

            return(productCodes);
        }