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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:53:56+00:00 2026-06-02T06:53:56+00:00

I am working with MVC3 and entity framework I have got a table with:

  • 0

I am working with MVC3 and entity framework

I have got a table with:

id – Day of the week – Muscle – amount of sets – Customer

This is one table… It’s just a simple little project.

But my problem is that I don’t know how to get the proper View to get.

  **Monday    Tuesday    Wednesday   Thursday   Friday   Saturday   Sunday**
    Muscle    Muscle     etc...
    sets      sets

What I think I should do…first getting the list of the days the customer (which he created) wants to workout

Model

fitnessday is an property which is connected with my database with datacontext.

so like

   public class FitnessDay
  {
    public int id { get; set; }
    public string dayoftheweek{ get; set; }
    public string muscle{ get; set; }
    public Nullable<int> sets{ get; set; }
    public Nullable<int> customerId{ get; set; }


     public virtual Customer Customers{ get; set; }
  }

  public class Customer 
   {
    public Customer()
    {
        this.fitnessDay = new HashSet<fitnessDay>();
    }

    // Primitive properties

    public int id { get; set; }
    public string name{ get; set; }
    public string lastname{ get; set; }

    // Navigation properties

    public virtual ICollection<fitnessDay> fitnessDay { get; set; }

 }

–

    private IList<fitnessDay> trainingList= null;

          public IList<fitnessDay> Training() 
       {
           string nameOfCustomer= "bob";
           var Training1 = db.fitness.Where(c => c.Customer.name== nameOfCustomer); 

           trainingList= Training1.ToList();
           return trainingList;

       }

Controller

        public ViewResult TrainingView()
    {
        var list = model.training();

        return View(list); 
    }

view

   Don't know how to show it here.

Can someone help me out get the day of the week and place the proper Muscle and set underneath it (there could be several muscles per day)

edit: new information added

  • 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-02T06:54:00+00:00Added an answer on June 2, 2026 at 6:54 am

    This was created to display the periodic table, but it’s a great piece of ui
    http://isotope.metafizzy.co/
    It does require a fair amount of jquery knowledge but, again, it’s a great piece of ui a very adaptable.
    That is, of course, if you’re looking for something a bit more that a calendar.

    edit
    Since jquery is really not your thing here’s what I think is a simple suggestion.
    On the controller side, load all training sessions ORDER ASC (I don’t know how to work with Linq but surely it can be done). I’m also assuming that you know the BETWEEN dates of traings you’re querying.
    So in the controller you’d aglomerate the dates like this:

        public ActionResult Trainings()
        {
            //dummy data
            var trainings = new List<Training>();
            trainings.Add(new Training { TrainingDay = DateTime.Now });
    
            var week = new Dictionary<DayOfWeek, List<Training>>() 
            { 
                { DayOfWeek.Monday, new List<Training>() },
                { DayOfWeek.Tuesday, new List<Training>() },
                { DayOfWeek.Wednesday, new List<Training>() },
                { DayOfWeek.Thursday, new List<Training>() },
                { DayOfWeek.Friday, new List<Training>() },
                { DayOfWeek.Saturday, new List<Training>() },
                { DayOfWeek.Sunday, new List<Training>() },
            };
            for (int i = 0; i < trainings.Count; i++) 
            {
                switch (trainings[i].TrainingDay.DayOfWeek)
                {
                    case DayOfWeek.Friday:
                        week[DayOfWeek.Friday].Add(trainings[i]);
                        break;
                    case DayOfWeek.Monday:
                        week[DayOfWeek.Monday].Add(trainings[i]);
                        break;
                    case .....
    
                }
            }
            return View(week);
        }
    

    this would get all the training’s in the same day together (I’ve heard that some people go the gym more that once a day, not sure if that’s true or not).
    Now, you can have your view strongly type, so you change it to something like:

    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Dictionary<DayOfWeek, List<Training>>>" %> 
    

    and don’t forget <%@ Import %> the Training namespace and finally you view could be something like this:

       <table>
            <tr>
                <td>Monday</td>
                <td>Tuesday</td>
                <td>Wednesday</td>
                <td>Thursday</td>
                <td>Friday</td>
                <td>Saturday</td>
                <td>Sunday</td>
            </tr>
            <tr>
                <%foreach (KeyValuePair<DayOfWeek, List<Training>> entry in Model){%>
                    <td>
                        <%if (entry.Key == DayOfWeek.Monday){
                           foreach (var training in entry.Value){
                            Response.Write(training.TrainingDay); 
                           } 
                        }%> 
                    </td>
                <%} %>
            </tr>
       </table>
    

    Obviously instead of repeating the same code for the entries you could create an extension method for the Html object.

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

Sidebar

Related Questions

I'm working with MVC3 and Entity Framework but i came to a point where
Assume we have an ASP.NET MVC3 Web site that makes use of Entity Framework
I am working on a MVC3 application with entity framework and SQL Server 2008.
I'm working with MVC3, and using Entity Framework 4.0 Entities as my model. So
I'm working with Entity Framework 4.1 in an MVC3 Web Application. I am tasked
I'm working on a page using ASP.NET MVC3, Razor and Entity Framework. I used
I have an MVC 3 project that I am working on using Entity Framework
I'm working on a MVC3 application and i'm using the Entity Framework linked to
I have been working on mvc3 application and trying to localize the same. I
I'm working with MVC3 with Razor for first time, and I have a partial

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.