Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ApartmentController : Controller
- {
- private readonly IApartmentRepository _apartmentRepository;
- public ApartmentController(IApartmentRepository apartmentRepository)
- {
- _apartmentRepository = apartmentRepository;
- }
- //...codes
- [HttpGet]
- public ActionResult List()
- {
- var apartmentList = _apartmentRepository.GetAll().ToList();
- return View(apartmentList);
- }
- //...codes
- }
- <div class="dataTables_wrapper">
- <table class="table table-bordered table-striped" id="dataTable">
- <thead>
- <tr>
- <th>Id</th>
- <th>Door Number</th>
- <th>Floor Number</th>
- <th>Capacity</th>
- <th>Fullness</th>
- <th>Apartment Name</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- @foreach (var item in Model.ToList())
- {
- <tr>
- <td>@item.Id</td>
- <td>@item.DoorNumber</td>
- <td>@item.FloorNumber</td>
- <td>@item.Capacity</td>
- <td>@item.Fullness</td>
- <td>@item.ApartmentRoom.Where(x => x.RoomID == item.Id).Select(x => x.Apartment.ApartmentName)</td>
- <td>
- @Html.ActionLink("Düzenle", "Edit", new { id = item.Id })
- @Html.ActionLink("Sil", "Delete", new { id = item.Id })
- </td>
- </tr>
- }
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement