Имам следната заявка, която работи добре. Въпреки това не работи в заявка за присъединяване, където е необходимо.
var ra = from c in _context.Wxlogs
select c;
if (year == "2011")
{
ra = (IQueryable<Wxlog>)(from c in _context.Wxlogs
where c.LogYear == year
&& (SqlFunctions.DatePart("Month", c.LogDate2) == m3)
&& c.LogTime.Contains("23:59")
orderby c.LogDate2
let LogDate = c.LogDate2
select new {
LogDate,
c.Rain_today
});
}
else if (year != "2011")
{
ra = (IQueryable<Wxlog>)(from c in _context.Wxlogs
where c.LogYear == year
&& c.LogMonth == mm
&& c.LogTime.Contains("08:59")
orderby c.LogDate2
let LogDate = EntityFunctions.AddDays(c.LogDate2, -1)
select new {
LogDate,
c.Rain_today
});
}
Затова се опитвах да вградя условията else if ( нещо като този отговор от Whaheed ) без никакъв късмет.
Всяка помощ ще бъде оценена.