public List <view_SearchProduct> MappingProductMongo(List <Models.tbProduct> model) { var data = new List <view_SearchProduct>(); var biztype = svBizType.GetBiztypeAll(); if (model != null && model.Count() > 0) { foreach (var item in model) { var it = new view_SearchProduct(); it.ProvinceName = item.ProvinceName; // it.ProvinceName = provinces.Where(m => m.ProvinceID == item.CompProvinceID).FirstOrDefault().ProvinceName; if (item.BizTypeID != 13) { it.BizTypeName = biztype.Where(m => m.BizTypeID == item.BizTypeID).FirstOrDefault().BizTypeName; } else { it.BizTypeName = item.BizTypeOther; } it.ProductID = (int)item.ProductID; it.ProductName = item.ProductName; it.ProductImgPath = item.ProductImgPath; it.ProductKeyword = item.ProductKeyword; it.ShortDescription = item.ShortDescription; it.ViewCount = item.ViewCount; it.CompID = item.CompID; it.ContactCount = (short)item.ContactCount; it.comprowflag = 2; it.CompLevel = getCompLevelByCompID(item.CompID); it.CompName = item.CompName; it.ListNo = item.ListNo; it.CreatedDate = item.CreatedDate; it.ModifiedDate = item.ModifiedDate; it.IsSME = false; data.Add(it); } } return(data); }
public List <view_SearchProduct> MappingProduct(List <view_ProductMobileApp> model) { var data = new List <view_SearchProduct>(); var biztype = svBizType.GetBiztypeAll(); var provinces = svAddress.GetProvinceAll(); if (model != null && model.Count() > 0) { foreach (var item in model) { var it = new view_SearchProduct(); it.ProvinceName = provinces.Where(m => m.ProvinceID == item.CompProvinceID).FirstOrDefault().ProvinceName; if (item.BizTypeID != 14) { it.BizTypeName = biztype.Where(m => m.BizTypeID == item.BizTypeID).FirstOrDefault().BizTypeName; } else { it.BizTypeName = item.BizTypeOther; } it.ProductID = item.ProductID; it.ProductName = item.ProductName; it.ProductImgPath = item.ProductImgPath; it.ProductKeyword = item.ProductKeyword; it.ShortDescription = item.ShortDescription; it.ViewCount = item.ViewCount; it.CompID = item.CompID; it.ContactCount = item.ContactCount; it.comprowflag = item.CompRowFlag; it.CompLevel = (byte)item.Complevel; it.CompName = item.CompName; it.ListNo = item.ListNo; it.CreatedDate = item.CreatedDate; it.ModifiedDate = item.ModifiedDate; data.Add(it); } } return(data); }