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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:02:00+00:00 2026-05-27T08:02:00+00:00

I have a web app that has a Diary. In this Diary, I can

  • 0

I have a web app that has a Diary. In this Diary, I can post updates and my friends can see it and vote. They can like, unlike, etc.

So, I take the 6 last posts, and I also have to take the votes (like, unlike, etc) for each post.

My problem is how could I get this impression votes related to the Diary post?
I tried this:

var impressions = "";

foreach (var item in diaryPosts)
{
    impressions = (from i in db.Impressions
                   select new ImpressionsSet
                   {
                       ImpressionID = i.ID,
                       ImpressionTitle = i.Impression,
                       ImpressionNum = i.DiaryImpressions.Count(d => d.DiaryPostsID == item.PostID)
                   }).ToList();
}

But with this approach, I get the error:

Cannot implicity convert type 'System.Collections.Generic.List<...>' to 'string'

I would like this var ‘impressions’ get all impressions related to these 6 last posts I show in my page.

So, foreach Diary post I have, I would have another foreach to my impressions and its Counts but on the other hand, this var ‘impressions’ would have 2 foreach loops inside, one for each post, and one foreach impression.

Could anyone help me with that with a sample for my Controller and for my razor View?
Is my explanation clear enough?
Thank you in advance.

  • 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-27T08:02:01+00:00Added an answer on May 27, 2026 at 8:02 am

    impressions is of type string.

    var impressions = "";

    And you try to assign list to that variable.

    Change it to

    List<ImpressionSet> impressions;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an asp.net web app that has this in the web.config file in
I have a web app that has a few processes that can take up
I have an existing web app that has a data layer and a bll
I have a very simple Mac Cocoa app that just has a Web View
I have a web app that only registered users can use, therefore I should
I have a web-app that has a master mysql db and four slave dbs.
I have a web app that has lots of pages with a URL of
I have an asp.net mvc web app that has controllers with role attributes on
I have a web app built with html5 boilerplate that has multiple skins available.
We have a web app (ASP) that has workflow in it for management to

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.