Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4115856
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:38:10+00:00 2026-05-20T22:38:10+00:00

I have the following in my db table: – MailingId | GroupName | ServiceId

  • 0

I have the following in my db table:

- MailingId | GroupName | ServiceId
-   1       |  group1   |   3
-   2       |  group1   |   5
-   3       |  group1   |   8
-   4       |  group2   |   null
-   5       |  group3   |   null
...

In my view i have 2 groups of checkboxes:

  • 1) (services) with id’s 3,5,8 (serviceId).
  • 2) and a list of checkboxes for mailing groups (group1, group2, group3)

I need to select the following using LINQ:

Select rows that I have selected in ServiceId checkbox list PLUS any other. For example if I check off ServiceId’s (3 and 5) and group “Group3” then my output would be rows MailingId: 1, 3 and 5. HOWEVER, if I select ANY service from (first group of checkboxes) AND DO NOT select “Group1” from mailing group checkboxes then rows with Group1 SHOULD NOT be in the output.

I’m using EF4. Please help.
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:38:11+00:00Added an answer on May 20, 2026 at 10:38 pm

    The 2 arrays would be the selections that are posted from your view

    int[] selectedservices = {3,5};
    string[] selectedgroups = {"group3"};
    
    using (Model model = new Model())
    {
        bool b = selectedservices.Contains(1);
    
                var mailinglists = from m in model.MalingSet
                                   where selectedgroups.Contains(m.GroupName)
                                   && ((m.ServiceId.HasValue && selectedservices.Contains(m.ServiceId.Value)) || m.ServiceId.HasValue == false)
                                   select m.MailingId;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have the following table: CREATE TABLE `tmp_table` ( `id` int(11) NOT NULL AUTO_INCREMENT,
I have following table and data: create table Foo ( id int not null,
I have the following table CREATE TABLE [dbo].[LogFiles_Warehouse]( [id] [int] IDENTITY(1,1) NOT NULL, [timestamp]
I have following table CREATE TABLE User ( email sysname NOT NULL, sign varbinary(256)
I have following table: ID ParentID 1 NULL 2 1 3 2 4 NULL
I have the following table definition: CREATE TABLE [Car] ( CarID int NOT NULL
I have the following table: create table stuff ( id mediumint unsigned not null
I have following table structure. town: id (MEDINT,PRIMARY KEY,autoincrement), town(VARCHAR(150),not null), lat(FLOAT(10,6),notnull) lng(FLOAT(10,6),notnull) i
Let's say I have following table: CREATE TABLE `occurences` ( `object_id` int(10) NOT NULL,
I have following Table with records for ActivityLog: ID, UserId, Category, Created 1 11

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.