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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:33:32+00:00 2026-05-23T17:33:32+00:00

I need a linq statement that returns all entries from a certain date. A

  • 0

I need a linq statement that returns all entries from a certain date. A the moment I have a class in my controller which handles Events. My Index class contains a linq statement which groups the vents by date and returns how many there are in each date. I want a browse class which returns a list of Events connected with a certain date. Here is my mode:

  namespace NewAtAClick.Models
  {
    public class WhatsOn
    {

    public int ID { get; set; }
    public DateTime? start { get; set; }
    public DateTime? end { get; set; }
    public string Name { get; set; }
    public string Desc { get; set; }
    public string link { get; set; }
    public bool CalenderDisplay { get; set; }
    public DateTime? day { get; set; }
    public int whtscount { get; set; }
    }
  }

And here’s my classes in the WhatsOn controller;

   public ViewResult Index(WhatsOn model)
   {
        DateTime myDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

        var datequery =
                        db.WhatsOns.Where(c => c.start > myDate)
                        .OrderByDescending(c => c.start)
                        .GroupBy(c => c.start).AsEnumerable().Select(
                        sGroup => new WhatsOn
                        {
                            day = sGroup.Key,
                            whtscount = sGroup.Count()
                        });

        return View(datequery);
    }

    public ViewResult Browse(DateTime? day , int? id)
    {         
        var eventsquery = from c in db.WhatsOns
                          where c.start == day
                           select c;

        return View(eventsquery);
    }

A the moment the linq query in the browse class returns nothing, just an empty table. Any help is greatly appreciated! Thanks.

UPDATE:

Hey! Got it working

Here;s my new controller;

    public ViewResult Browse(int? id, DateTime? day, DateTime? start)
    {

        var eventsquery = from c in db.WhatsOns where c.start.Value.Day == day.Value.Day select c;

        return View(eventsquery);


    }

And what did the trick, in my actionlink in my view….

 @Html.ActionLink("Browse", "Browse", new { start=item.start, day=item.day })

Thanks for you help!!

  • 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-23T17:33:33+00:00Added an answer on May 23, 2026 at 5:33 pm

    does

    var eventsquery = from c in db.WhatsOns
                      where c.start.Value.Date == day.Value.Date
                      select c;
    

    work?

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

Sidebar

Related Questions

I have a LINQ statement that returns an anonymous type. I need to get
I have a statement similar to this that I need to run in Linq.
I have LINQ statement that looks like this: return ( from c in customers
I am using a LINQ statement that selects from various tables information I need
I have a linq statement that returns a list of records based on where
I have a pretty complex linq statement I need to access for different methods.
I have the following LINQ query that I need to translate to Entity SQL
I need to replicate a T-SQL statement that has an inner select, using LINQ:
Consider the database schema in the picture. I need a linq-to-entities statement that will
I need to create a Linq query that would have the following logic: IEnumerable<string>

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.