public Expression <Func <Exhibition, bool> > Lambdas(ExhibitionWhere Where) { Expression <Func <Exhibition, bool> > exp = LambdasHelper.True <Exhibition>(); if (Where != null) { if (!string.IsNullOrEmpty(Where.Title)) { exp = exp.And(c => c.Title.Contains(Where.Title)); } if (!string.IsNullOrEmpty(Where.Synopsis)) { exp = exp.And(c => c.Title.Contains(Where.Synopsis)); } if (!string.IsNullOrEmpty(Where.Time1)) { exp = exp.And(c => c.Time >= DateTime.Parse(Where.Time1)); } if (!string.IsNullOrEmpty(Where.Time2)) { exp = exp.And(c => c.Time <= DateTime.Parse(Where.Time2)); } } return(exp); }
public Expression <Func <ContentList, bool> > Lambdas(ContentListWhere Where) { Expression <Func <ContentList, bool> > exp = LambdasHelper.True <ContentList>(); if (CookieHelper.GetCookie("ContentListShow") == "1") { exp = exp.And(c => c.IsShow == true); } if (Where == null) { return(exp); } if (!string.IsNullOrEmpty(Where.Author)) { exp = exp.And(c => c.Author.Contains(Where.Author)); } if (!string.IsNullOrEmpty(Where.Content)) { exp = exp.And(c => c.Content.Contains(Where.Content)); } if (!string.IsNullOrEmpty(Where.Title)) { exp = exp.And(c => c.Title.Contains(Where.Title)); } if (!string.IsNullOrEmpty(Where.Label)) { exp = exp.And(c => c.Label.Contains(Where.Label)); } if (!string.IsNullOrEmpty(Where.LastTime1)) { exp = exp.And(c => c.LastTime >= DateTime.Parse(Where.LastTime1)); } if (!string.IsNullOrEmpty(Where.LastTime2)) { exp = exp.And(c => c.LastTime <= DateTime.Parse(Where.LastTime2)); } if (!string.IsNullOrEmpty(Where.Time1)) { exp = exp.And(c => c.Time >= DateTime.Parse(Where.Time1)); } if (!string.IsNullOrEmpty(Where.Time2)) { exp = exp.And(c => c.Time <= DateTime.Parse(Where.Time2)); } return(exp); }