29.05.2015 Views

o_19mgorv9t13a3ko71fev19l81mqa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

the application will require, even if it results in an odd appearance initially. I added a view file called Index.cshtml to the<br />

Views/Home folder, the contents of which you can see in Listing 27-5.<br />

Listing 27-5. The Contents of the Index.cshtml File<br />

@using WebServices.Models<br />

@model IEnumerable<br />

@{<br />

ViewBag.Title = "Reservations";<br />

Layout = "∼/Views/Shared/_Layout.cshtml";<br />

}<br />

@section Scripts {<br />

}<br />

@section Body {<br />

<br />

@Html.Partial("Summary", Model)<br />

<br />

}<br />

<br />

@Html.Partial("Editor", new Reservation())<br />

<br />

The view model for this view is an enumeration of Reservation objects and I rely on two partial views to provide the<br />

functional building blocks that the user will see. The first partial view file is called Summary.cshtml. I created the file in the<br />

Views/Home folder and you can see the contents of the file in Listing 27-6.<br />

Listing 27-6. The Contents of the Summary.cshtml File<br />

@model IEnumerable<br />

Reservation Summary<br />

<br />

<br />

<br />

IDNameLocation<br />

<br />

<br />

@foreach (var item in Model) {<br />

<br />

@item.ReservationId<br />

@item.ClientName<br />

@item.Location<br />

<br />

@Html.ActionLink("Remove", "Remove",<br />

new { id = item.ReservationId },<br />

new { @class = "btn btn-xs btn-primary" })<br />

<br />

<br />

}<br />

<br />

709

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!