Hello everyone,
I am developing a MVC4 project. I did lots of things. This part is the end of project.
Basically, system has teachers and an admin. Teachers select a day and free time(s)
Admin wants to see all the free times in a table. I create a table as Calendar in DB. I keep TeacherID, DayID and Explanation( that field keeps the free times as string.)
In view side a took the list of calendar items as model.
I want to create a table
@foreach(day in ViewBag.Days)
|
---|
@model IEnumerable<KampusOzelDersProjesi.Models.Takvim>
<div class="container-fluid">
<div class="row-fluid">
<!--
<div class="span9" id="content">
<!--
<div class="row-fluid">
<!--
<div class="block">
<div class="navbar navbar-inner block-header">
<div class="muted pull-left">
Takvim</div>
</div>
<div class="block-content collapse in">
<div class="span12">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"
id="example">
<thead>
<tr>
<th>
<center>
#
</center>
</th>
@foreach (var gunler in ViewBag.Gunler)
{
<th>
<center>
@gunler.Adi
</center>
</th>
}
</tr>
</thead>
<tbody>
@foreach (var takvim in Model)
{
<tr class="odd gradeX">
<td>
<center>
@takvim.Ogretmen.Adi
</center>
</td>
<td>
<center>
</center>
</td>
<td>
<center>
</center>
</td>
<td>
<center>
</center>
</td>
<td>
<center>
</center>
</td>
<td>
<center>
</center>
</td>
<td>
<center>
</center>
</td>
<td>
<center>
</center>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<!--
</div>
<!--
</div>
</div>
</div>
</div>
Till this part, everything is Ok.
In the head of table, there are days(the easiest part)
In the table body part, the first row should be teacher names and surnames. If I use the Model in foreach, as expected there are double teacher names in the first column; such as FofRoot, FoxRoot, FoxRoot. The other problem, How can I get the items of teacher 'X' at Day 'Y' ?
I need help on algorithm.
Project is being developed on Asp.Net MVC4.