❔ How to populate my IGrouping with null values??
So I have this way of grouping items, and I'm a little stuck.
I have two classes, one is the child of another. This is the model of data from the Database.
Now what I want to do with this data, is render it in a
<table>
(in Blazor), but grouped by week.
However, what I have now, is that it only populates the existing items, but what I want is for the table to look like the image (For <example> in the image, see second image)
Now I have the items the user has added to their List<Days>
grouped by week number with the following piece of code (Thanks to someone on this server):
But what I don't know now, and why I came to you awesome guys, is to help me figure out how I am going to populate the IEnumerable<IGrouped<int, Hours>>
with null values for each of the Dates in my Hours.WorkedDays
(List<Days>
)
And then render an empty container for the days that have "null" in them, and render the already existing items in the days of the week they belong to, but both having the option to add an item to that specific day.
And afterwards, how am I going to render the entire grouping back into a List so I can push that back into the Hours class, and update the database.
Hope my question isnt too vague..2 Replies