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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:56:08+00:00 2026-05-28T06:56:08+00:00

I have a timetable for student so they can attend to course on the

  • 0

I have a timetable for student so they can attend to course on the week.
And I don’t know how I should build my ViewModel.

I decided this :

class CourseTableViewModel
{
    CourseTableHeaderViewModel[] Headers;
    CourseTableRowViewModel[] Rows;
}

class CourseTableRowViewModel
{
    int HourStart;
    CourseTableCellViewModel[] Cells;
}

class CourseTableHeaderViewModel
{
    DateTime Date;
}

class CourseTableCellViewModel
{
    CourseViewModel[] Courses;//null if no course at this time
}

but for me it seems like to heavy for my view model. Maybe I should only send the CourseViewModel[] and then on my cshtml do all the table/row/cell work.

Does the viewmodel should really look like my view ?

EDIT : I’ll show my data as a Time Table with the days of the week as headers, and a row foreach hour of the day.
If a course take 2 hour it’ll occupy 2 rows.
There’ll be a button “Attend” or “Cancel” on each course’s cell.

PS : I know about jquery fullcalendar, but I’m just trying to learn how to build my viewmodel here.

  • 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-28T06:56:09+00:00Added an answer on May 28, 2026 at 6:56 am

    but for me it seems like to heavy for my view model. Maybe I should
    only send the CourseViewModel[] and then on my cshtml do all the
    table/row/cell work.

    The way you build your ViewModel MUST NOT depend on the way the View is organized, otherwise you break separation of concerns between View and Controller.
    The fact that you decided to use a kind of table to show your courses MUS NOT be reflected on the ViewModel, otherwise a change in the way the View is organized would cause a chain reaction on the controller code.

    Pass to the View just ALL INFORMATION it needs to render the courses, and then, in the View do all JOB that is needed to show your table.

    Doing transformations of data in the View may cause problems when you are in edit mode because the inverse transformation is not applied by the model binder when it receives the posted data. If you have this problem give a look to Mvc Controls Toolkit in-line transformations there: http://mvccontrolstoolkit.codeplex.com/wikipage?title=In-Line%20Transformations

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

Sidebar

Related Questions

I have a code like this... function diagnoseprint() { document.getElementById('goeshere').innerHTML=localStorage['timetable']; var decode = JSON.parse(localStorage['timetable']);
In my web page I have to create a timetable , where user can
Please help me on this problem. I have 2 identical tables, one is timetable
I have attempted this is many ways but failed consistently, hopefully you can help
Quite a complex question: At the moment I have a table called timetable. This
I have a question about scheduling. I need to make a timetable generator for
I have a .Net winforms project with a short time table (about a week
have written this little class, which generates a UUID every time an object of
I have to implement an algorithm that generates a timetable for a university. I've
I have this query: UPDATE student_info set grade = (SELECT tempTable.grade FROM tempTable WHERE

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.