public List<Offence> GetOffenceCondition(OffenceSearchCondition condition) { var where = PredicateExtensionses.True<Offence>(); if (condition.TypeId != 0) { where = where.And(u => u.Type.Id == condition.TypeId); } var offenceList = Db.Offences.Where(where); return offenceList.ToList(); }
public ActionResult Search(OffenceSearchCondition condition) { var business = new OffenceBusiness(Db); return Content(JsonConvert.SerializeObject(business.GetOffenceCondition(condition), DateTimeConverter)); }