Code: Select all
[HttpPost]
public JsonNetResult LingInsight(int ContactID)
{
var simpleQuery = db.Contact.Where(c => c.IDContact == ContactID).Select(c => c.FirstName).FirstOrDefault();
return new JsonNetResult(new { status = "OK" });
}
Seems odd that I have to enter values for two fields when there is only 1 parameter to this query. But when I add join in to a query, it becomes unusable. Running the below query 'queryWithJoin' prompts for parameters for the fields in each join as well, i know the value for 'detailID', but I don't know the values for the fields used in the join and to enter parameters here would reduce the number of results.
Code: Select all
[HttpPost]
public JsonNetResult LingInsight(int detailID)
{
var queryWithJoin = (from detail in db.ContactDetail
join cont in db.Contact on detail.ContactID equals cont.IDContact
where detail.IDContactDetail == detailID
select new { cont.FirstName, detail.DetailValue }).ToList();
return new JsonNetResult(new { status = "OK" });
}
The parameters ContactID and IDContact are required and can't continue without entering a value for them. Is this a limitation of Linq Insight or am I doing it wrong?