public IEnumerable <R_District> GetDistrictListAdvancedSearch( int?countryId , string name , string code , double?latitude , double?longitude , bool?active ) { IEnumerable <R_District> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_District") .Where("IsDeleted = 0" + (countryId != null ? " and CountryId like '%" + countryId + "%'" : "") + (name != null ? " and Name like '%" + name + "%'" : "") + (code != null ? " and Code like '%" + code + "%'" : "") + (latitude != null ? " and Latitude like '%" + latitude + "%'" : "") + (longitude != null ? " and Longitude like '%" + longitude + "%'" : "") + (active != null ? " and Active = " + (active == true ? "1" : "0") : "") ) ; results = R_District.Query(sql); return(results); }
public IEnumerable <R_District> GetDistricts() { IEnumerable <R_District> results = null; var sql = PetaPoco.Sql.Builder .Select("*") .From("R_District") .Where("IsDeleted = 0") ; results = R_District.Query(sql); return(results); }