Movies are editable as well

This commit is contained in:
2019-01-23 20:22:25 +01:00
parent 11b51493fe
commit ecadd21228
16 changed files with 678 additions and 19 deletions

View File

@ -0,0 +1,37 @@
@model Vidly.ViewModels.MovieFormViewModel
@{
ViewBag.Title = "New";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@if (Model.Movie.Id == null || Model.Movie.Id == 0)
{
<h2>New Movie</h2>
}
else
{
<h2>Edit Movie</h2>
}
@using (Html.BeginForm("Save", "Movies"))
{
<div class="form-group">
@Html.LabelFor(m => m.Movie.Name)
@Html.TextBoxFor(m => m.Movie.Name, new { @class = "form-control" })
</div>
<div class="form-group">
@Html.LabelFor(m => m.Movie.ReleaseDate)
@Html.TextBoxFor(m => m.Movie.ReleaseDate, "{0:d MMM yyyy}", new { @class = "form-control" })
</div>
<div class="form-group">
@Html.LabelFor(m => m.Movie.MovieGenreId)
@Html.DropDownListFor(m => m.Movie.MovieGenreId, new SelectList(Model.MovieGenres, "Id", "Name"), "Select Genre Type", new { @class = "form-control" })
</div>
<div class="form-group">
@Html.LabelFor(m => m.Movie.NumberInStock)
@Html.TextBoxFor(m => m.Movie.NumberInStock, new { @class = "form-control" })
</div>
@Html.HiddenFor(m=>m.Movie.Id)
<button type="submit" class="btn btn-primary">Save</button>
}