public List <Alliance> GetAlliances(AllianceQueryObj queryObj) { try { using (var ctx = new BaseDBContext()) { var predicate = PredicateBuilder.True <Alliance>(); if (queryObj.BallType != null) { predicate = predicate.And(p => p.BallType.Equals(Convert.ToInt32(queryObj.BallType))); } if (!string.IsNullOrEmpty(queryObj.SearchStr)) { predicate = predicate.And(p => p.AllianceName.Contains(queryObj.SearchStr)); } Func <Alliance, bool> query = predicate.Compile(); var result = ctx.Alliances.Where(query).ToList(); return(result); } } catch (Exception ex) { throw ex; } }
public List <BallCountry> GetBallCountrys(AllianceQueryObj queryObj) { try { using (var ctx = new BaseDBContext()) { return(ctx.BallCountries.ToList()); } } catch (Exception ex) { throw ex; } }