【发布时间】:2010-04-08 20:00:26
【问题描述】:
如何使这个方法返回布尔值,取决于查询返回。假 - 没有,真 - 数据存在。在我刚刚从 uniqueQuote.Count() 返回 int 但看起来不是很好的方法之前。谢谢!
private bool CheckEnquiryUser(int enquiryId, Guid userId)
{
int selectedEnquiryId = enquiryId;
Guid currentUserId = userId;
Entities ctx3 = new Entities();
var uniqueQuote = from quot in ctx3.Enquiries.Include("aspnet_Users")
where quot.EnquiryId == selectedEnquiryId &&
quot.aspnet_Users.UserId == currentUserId
select quot;
bool exist = uniqueQuote;
return exist;
【问题讨论】: