私はlinq to sqlの学習過程にあります。
これらの次の条件をlinq to sqlで書くことは可能ですか?
条件1
var query1 =
if
from q in db.Students
q.fees =="paid" && q.activites == "good" && count == 0
select q
save "OK" to the property result.
else
from q in db.Students
q.fees =="paid" && q.activites == "good" && count == 2
select q
save "better" to the property result.
else
from q in db.Students
q.fees =="paid" && q.activites == "good" && count > 2
select q
save "bad" to the property result.
private string _result;
public string Result
{
get { return this._result; ; }
set { this._result; = value; }
}
親切にガイド。
更新編集:
var query1 =
(from q in db.Students
q.fees =="paid" && q.activites == "good"
select q).Any();
if(count ==0 && query1 == true)
{
this.Result = "OK"
}
esle if(count == 2 && query1 == true)
{
this.Result = "better"
}
esle
{
this.Result = "bad"
}
これはアプローチになりますか?