Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. public class ApartmentController : Controller
  2. {
  3. private readonly IApartmentRepository _apartmentRepository;
  4.  
  5. public ApartmentController(IApartmentRepository apartmentRepository)
  6. {
  7. _apartmentRepository = apartmentRepository;
  8. }
  9.  
  10. //...codes
  11.  
  12. [HttpGet]
  13. public ActionResult List()
  14. {
  15. var apartmentList = _apartmentRepository.GetAll().ToList();
  16. return View(apartmentList);
  17. }
  18.  
  19. //...codes
  20. }
  21.  
  22. <div class="dataTables_wrapper">
  23. <table class="table table-bordered table-striped" id="dataTable">
  24. <thead>
  25. <tr>
  26. <th>Id</th>
  27. <th>Door Number</th>
  28. <th>Floor Number</th>
  29. <th>Capacity</th>
  30. <th>Fullness</th>
  31. <th>Apartment Name</th>
  32. <th></th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. @foreach (var item in Model.ToList())
  37. {
  38. <tr>
  39. <td>@item.Id</td>
  40. <td>@item.DoorNumber</td>
  41. <td>@item.FloorNumber</td>
  42. <td>@item.Capacity</td>
  43. <td>@item.Fullness</td>
  44. <td>@item.ApartmentRoom.Where(x => x.RoomID == item.Id).Select(x => x.Apartment.ApartmentName)</td>
  45. <td>
  46. @Html.ActionLink("Düzenle", "Edit", new { id = item.Id })
  47. @Html.ActionLink("Sil", "Delete", new { id = item.Id })
  48. </td>
  49. </tr>
  50. }
  51. </tbody>
  52. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement