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

  • Home
  • SEARCH
  • 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 7527757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:11:06+00:00 2026-05-30T04:11:06+00:00

I have an object Invoice which belongs to an Area: public class Invoice :

  • 0

I have an object Invoice which belongs to an Area:

public class Invoice : IEntity, IValidatableObject
    {
            ...

        public virtual int? AreaId { get; set; }
            ...
        // Navigation properties
        public virtual Area Area { get; set; }
            ...
    }

I also have a User object which can belong to multiple areas:

public class User : IEntity, INamedType
    {
        ...

        //Navigation properties
        public virtual ICollection<Area> Areas { get; set; }

        ...
    }

What I’m wanting to achieve is to get for a user all the invoices that belong to any of their areas. I tried writing it but it’s not even close to right:

var invoices = _db.Invoices.Where(x => x.AreaId == user.Areas.Contains(z => z.Id));

Can anyone help me with this query?

  • 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-30T04:11:08+00:00Added an answer on May 30, 2026 at 4:11 am
    var invoices = _db.Invoices.Where(x =>  user.Areas.Any(z => z.Id == x.AreaId));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have an Invoice object like so: public class Invoice { public virtual
I have object A which in turn has a property of type Object B
I have object A which contains multiple instances of object B, which in turn
I have an Object X which owns (owns pointers to and initializes) Objects Y1..10
I have an object of a class, and I want to duplicate it with
I'm writing an application on qooxdoo. I have a class, which should return table
I have an object JobBreakdown that has_one :invoice . If a JobBreakdown has an
I have a web service that accepts an Invoice, which contains LineItem children. It
I have an API class, lets call it MyClass, which I want to be
I have /invoices/ controller and @service object. When /services/1/invoices/new is called, a new @invoice

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.