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 9085329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:13:07+00:00 2026-06-16T21:13:07+00:00

I have the following class:- public class ContactsDetails { public IEnumerable<AaaUserContactInfo> Info { get;

  • 0

I have the following class:-

public class ContactsDetails
    {
        public IEnumerable<AaaUserContactInfo> Info { get; set; }
    }

where AaaUserContactInfo has two foreign keys refering to other tables:-

public partial class AaaUserContactInfo
    {
        public long USER_ID { get; set; }
        public long CONTACTINFO_ID { get; set; }
        public string desc { get; set; }

        public virtual AaaContactInfo AaaContactInfo { get; set; }
        public virtual AaaUser AaaUser { get; set; }
    }

Now i have the following class which intiate a new ContactDetails object:-

public ActionResult CustomersDetails(long[] OrganizationIds)
{

    if (OrganizationIds == null)
    {
        return RedirectToAction("customer", new { isError = true });
    }
    else
    {

        var ContactsDetails = new ContactsDetails
        {
            Info = r.getcontactinfo(OrganizationIds)
        };
    }

        return View();    

}

now i need to return all the AaaUserContactInfo object which have their emails Ids containing part of the organization name,, something similar to:-

public IEnumerable<AaaUserContactInfo> getcontactinfo(long[] Organizationid)
        {
            var result = ((from uci in entities.AaaUserContactInfoes
                          join ci in entities.AaaContactInfoes on uci.CONTACTINFO_ID equals ci.CONTACTINFO_ID
                          where ci.EMAILID.ToString() == // contains any organization name in their emailIds ,, where i can get the organization name using sonthing similar to var orgname = entities.SDOrganizations.Where(a => a.ORG_ID == OrganizationIds[i]).FirstOrDefault().NAME;
                               select uci)) ;
            return result;
                                }
  • 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-06-16T21:13:08+00:00Added an answer on June 16, 2026 at 9:13 pm

    Can you try to use next query? I don’t know what you want to do if FirstOrDefault() in your example return null. In my case no exception will be throws, but not records will be returned. Please note about the details of the implementation and if it worked at all.

    public IEnumerable<AaaUserContactInfo> getcontactinfo(long[] organizationIds)
    {
        var organizationNames = entities.SDOrganizations
                               .Where(org => organizationIds.Contains(org.ORG_ID))
                               .Select(org=> org.Name);
    
    
        var result = from userContactInfo in entities.AaaUserContactInfoes
                     join contactInfo in entities.AaaContactInfoes on userContactInfo.CONTACTINFO_ID equals contactInfo.CONTACTINFO_ID
    
                     //check if EMAILID string has at least one organizationName as substring
                     where organizationNames.Any(orgName => contactInfo.EMAILID.ToString().Contains(orgName))
                     select userContactInfo;
        return result;
    }
    

    EDIT: updated an answer to handle many organizations selected on the basis of Organizationid. Then entities.AaaContactInfoes are selected if EMAILID is contained in name field of at least one ogranization.

    NOTE: i have renamed some arguments used only in the method scope, just to make code more readable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following class: class A { public IEnumerable Song { get; set; }
I have the following class public class Account { IEnumerable<AccountData> Data { get; set;
I have the following class public class UIControl { public string FName{ get; set;
I have the following class: public class Movie { string Name get; set; string
I have the following class: public class EmailData { public string FirstName{ set; get;
i have the following class: public class Worker { public int WorkerID {get;set;} public
I have the following class: public class ExternalClass { public string Name {get;set;} public
I have the following class public class Car { public Name {get; set;} }
I have the following class public class MenuVeiculo { public string Nome { get;
I have the following class public class CountrySpecificPIIEntity { public string Country { get;

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.