Thursday, December 4, 2014

Pluralsight Mongodb ASP.NET MVC replace demo



add new class for price adjustment



update view to have link for price adjustment




@model IEnumerable<realEstate.Rentals.Rental>

@{
    ViewBag.Title = "Rental Listings";
}

<h2>Rental Listings</h2>

<p>
    @Html.ActionLink("Post Rental", "Post")
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.NumberOfRooms)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Address)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Price)
        </th>
        <th>Last Adjustment</th>
        <th></th>
        <th></th>
    </tr>

    @foreach (var rental in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => rental.Description)
            </td>
            <td>
                @Html.DisplayFor(modelItem => rental.NumberOfRooms)
            </td>
            <td>
                @String.Join(" ", rental.Address)
            </td>
            <td>
                @Html.DisplayFor(modelItem => rental.Price)
            </td>
            <td>
                @rental.Adjustments.Select(a => a.Describe()).LastOrDefault()
            </td>
            <td>
                @Html.ActionLink("Adjust Price", "AdjustPrice", new { id = rental.Id })
            </td>
            <td>
                @Html.ActionLink("Delete", "Delete", new { id = rental.Id })
            </td>
        </tr>
    }


</table>

Change controller to add action for AdjustPrice


Add new view for action Adjust price



No comments:

Post a Comment