问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
public List<IB_VIEW_IU> Load(Guid? topicid, string title, string email, string type, string isgold, string astatus, string pstatus, int rows, int page, out int total)
{
var res = from idea in ideaDao.dbContext.IB_IDEA
join u in ideaUserDao.dbContext.IB_USER on idea.Creator equals u.ID into tmpU
from user in tmpU.DefaultIfEmpty()
where (string.IsNullOrEmpty(title) || idea.Title.Contains(title))
&& (string.IsNullOrEmpty(email) ? 0 == 0 : user.Email.ToString().Equals(email))
&& (string.IsNullOrEmpty(type) ? 0 == 0 : idea.IsTeam.ToString().Equals(type))
&& (string.IsNullOrEmpty(isgold) ? 0 == 0 : idea.IsGolden.ToString().Equals(isgold))
&& (string.IsNullOrEmpty(astatus) ? 0 == 0 : idea.AppState.ToString().Equals(astatus))
&& (string.IsNullOrEmpty(pstatus) ? 0 == 0
: pstatus == "0" ?idea.IsPut == 0 || idea.IsPut == 3
: pstatus == "1" ? idea.IsPut == 1
: pstatus == "2" ? idea.IsPut == 2
: pstatus == "3" ? idea.IsPut == 0
: pstatus == "4" ? idea.IsPut == 1 || idea.IsPut == 2 || idea.IsPut == 3
: pstatus == "5" ? idea.IsPut == 4: idea.IsPut == 3)
//&& ((topicid == Guid.Empty || string.IsNullOrEmpty(topicid.ToString())) ? 0 == 0 : idea.TopicID == topicid)
&& ((topicid == Guid.Empty || string.IsNullOrEmpty(topicid.ToString())) ? idea.TopicID == null : idea.TopicID == topicid)
orderby idea.CreateDate descending
select new IB_VIEW_IU()
{
ID = idea.ID,
IsTeam = idea.IsTeam,
Categorie = idea.Categorie,
Title = idea.Title,
Description = idea.Description,
Keyword = idea.Keyword,
Programme = idea.Programme,
IsGolden = idea.IsGolden,
Comment = idea.Comment,
Remark = idea.Remark,
Approver = idea.Approver,
AppState = idea.AppState,
GoldenApprover = idea.GoldenApprover,
Creator = idea.Creator,
CreateDate = idea.CreateDate,
Modifier = idea.Modifier,
ModifyDate = idea.ModifyDate,
TopicID = idea.TopicID,
UserID = user.UserID,
Mail = user.Email,
liketotal=idea.LikeTotal,
IsPut = idea.IsPut
};
var retList = res.ToList();
total = retList.Count();
return retList.Skip(rows * (page - 1)).Take(rows).ToList();
}
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果