ASP.NET check if LinqToEntities returned something or not.
- by Alex
How to make this method return boolean value, depending on query return. False - nothing, True - data exists. Before i just returned int from uniqueQuote.Count() but does not look like great method. Thank you!
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;