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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:29:17+00:00 2026-06-14T10:29:17+00:00

Please see code below : public class NewsFilterModel { public CtArticleDetail ArticleDetail { get;

  • 0

Please see code below :

public class NewsFilterModel
{
    public CtArticleDetail ArticleDetail { get; set; }

    public PcPage Page { get; set; }
}

public IEnumerable<NewsFilterModel> GetNewsFilterModelByTagNames(string tagNames, int status)
{
     var resultArticle = db.CtArticleDetail.Where(m => m.tagNames == tagNames);
     var resultPage  = db.PcPage.Where(m => m.tagNames == tagNames);
}

Can anyone please advice what the best way to combine two model to one model which is NewsFilterModel ?

What I am trying to achieve is:

NewsFilterModelList

1.Article1
2.Page1
3.Article2
4.Page2
5.Article3
6.Page3

I’ve ended this like below:

foreach (var item in pageResult)
            {
                resultList.Add(new NewsFilterModel { ArticleDetail = null, Page = item, Date = item.UpdatedOn.ToDateTime() });
            }

            foreach (var item in tempArticleList)
            {
                resultList.Add(new NewsFilterModel { ArticleDetail = item, Page = null, Date = item.LiveDate.ToDateTime() });
            }

            return resultList.AsEnumerable();

Anyone has better idea, please advice.

  • 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-14T10:29:18+00:00Added an answer on June 14, 2026 at 10:29 am

    You can use Union to combine the result sets

    var query1 = db.CtArticleDetail
        .Where(a => a.tagNames.Equals(tagNames))
        .Select(a => new NewsFilterModel() { ArticleDetail = a, Page = null });
    var query2 = db.PcPage
        .Where(a => a.tagNames.Equals(tagNames))
        .Select(a => new NewsFilterModel() { ArticleDetail = null, Page = a });
    var query3 = query1.Union(query2)
        //.OrderBy(a => a.Date); -- Order here
        ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see the code below: public partial class Form1 : Form { public Form1()
Please see an example of my code below: CODE UPDATED public class ScrollableCheckboxList {
I have problem with session and query execution,please see code below. class A implements
I have problem with session and query execution, please see code below. class A
I have a function(please see code below) which reads some data from the web.
Please see the code below: #include <iostream> #include <stdlib.h> #include <time.h> using namespace std;
I've a problem with CakePHP __() function. Please see the code below : $options
I am using vb.net code. I have grid view, please see the code below:
Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
Please see the code snippet below : #include <iostream> using namespace std; int main()

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.