I working on ap.net razor page LINQ to function . i 问题一:
<代码>viewmodel PropertyLPOvm
<><><>>>>>
如果有2或3行,每样一行都是一样的,再三重复,则只需要归还一个独一无二或独一无二的行,因为其他行是重复的。
确切地说,需要用群体而不是不同的群体来恢复不同的结果。
i 尝试使用以下不同的词语,但不得退回不同的行文。
这样一来解决问题
public List<AssetLPOvm> GetAllLpoDetails(string SelectedCompany)
{
var AssetBranches = _unitOFWorkAsset.AssetBranches.GetList(x => x.CompanyNo == SelectedCompany && Convert.ToInt32(x.UserID) > 0 );
var NewAssetTagging = _unitOFWorkAsset.NewAssetTagging.GetList(x => x.LPONo > 0);
var result = (from assetBranch in AssetBranches
join user in Users on assetBranch.UserID equals user.UserID
join assetTagging in NewAssetTagging on Convert.ToDecimal(assetBranch.LPONO) equals assetTagging.LPONo
select new AssetLPOvm
{
AssetItemNo= assetBranch.AssetItemNo,
SupplierName=assetTagging.SupplierName,
SelectedMCUName= assetBranch.SelectedMCUName,
AssetOwner=assetBranch.AssetOwner,
ItemCode=assetBranch.ItemCode,
Qty = assetBranch.Qty,
LPONO = assetBranch.LPONO
}).Distinct().ToList();
return result;
}
public class AssetLPOvm
{
public string LPONO { get; set; }
public string AssetItemNo { get; set; }
public string SupplierName { get; set; }
public string SelectedMCUName { get; set; }
public string AssetOwner { get; set; }
public double Qty { get; set; }
public string ItemCode { get; set; }
}
public class AssetBranches
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public decimal ID {get;set;}
public string AssetItemNo { get; set; }
public string SelectedMCUName { get; set; }
public string AssetOwner { get; set; }
public double Qty { get; set; }
public string LPONO { get; set; }
public string ItemCode { get; set; }
}
public class NewAssetTagging
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public decimal ID { get; set; }
public decimal? LPONo { get; set; }
public decimal? SupplierNumber { get; set; }
}
public class User
{
public string vLoginName {get;set;}
public string UserName {get;set;}
}
如何通过功能而不是利用不同功能来分组?
我尝试的是独一无二的,但又不回头。