public List <SiteCampaignViewModel> GetAllSiteCampaignByLobID(long lobID, bool?active) { var query = string.Format(@"SELECT sc.ID , sc.SiteID , sc.CampaignID , sc.Active FROM SiteCampaign sc INNER JOIN SiteCampaignLoB scl ON scl.SiteID = sc.SiteID AND scl.CampaignID = sc.CampaignID WHERE scl.LobID = {0} AND sc.Active = {1} AND scl.Active=1", lobID, (active == true ? 1 : 0)); var siteCampaign = _context.GetList <SiteCampaignViewModel>(query); return(siteCampaign); }