public ActionResult Detail() { string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty); string flag = WebUtil.GetQueryStringValue <string>("flag", string.Empty); Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(); OutStorageEntity entity = new OutStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity = entity.IsNull() ? new OutStorageEntity() : entity; ViewBag.Entity = entity; ViewBag.OutType = EnumHelper.GetEnumDesc <EOutType>(entity.OutType); ViewBag.Status = EnumHelper.GetEnumDesc <EAudite>(entity.Status); OutStoDetailEntity detail = new OutStoDetailEntity(); detail.OrderNum = orderNum; List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail); listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult; ProductProvider provider = new ProductProvider(); List <ProductEntity> list = provider.GetAllList(); list = list.IsNull() ? new List <ProductEntity>() : list; listResult.ForEach(a => { ProductEntity product = null; if (a.BarCode.IsEmpty()) { product = list.SingleOrDefault(b => b.SnNum == a.ProductNum); } else { product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode); } //if (product.IsNotNull()) //{ // a.Size = product.Size.IsEmpty() ? "" : product.Size; //} //else //{ // a.Size = ""; //} }); ViewBag.Detail = listResult; ViewBag.Flag = flag; return(View()); }