Skip to content

Commit 99f1ff9

Browse files
committed
complete detail and edit view for books
1 parent 93d03d3 commit 99f1ff9

File tree

11 files changed

+48
-5
lines changed

11 files changed

+48
-5
lines changed

.vs/BookShopInventoryApp/v14/.suo

4 KB
Binary file not shown.

BookShopInventoryApp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@
332332
<Content Include="Views\Book\Details.cshtml" />
333333
<Content Include="Views\Book\Edit.cshtml" />
334334
<Content Include="Views\Book\Delete.cshtml" />
335+
<Content Include="Views\Publisher\Details.cshtml" />
335336
</ItemGroup>
336337
<ItemGroup>
337338
<Folder Include="App_Data\" />

Controllers/BookController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public ActionResult Edit(int id)
108108
Year = x.Year,
109109
ISBN = x.ISBN,
110110
StockLevel = x.StockLevel,
111-
PublisherName = x.Publisher.Name
112-
//PublisherId = x.PublisherId
111+
PublisherName = x.Publisher.Name,
112+
PublisherId = x.PublisherId
113113
}).SingleOrDefault();
114114

115115
PreparePublisher(model);

Views/Book/Edit.cshtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@
4848
</div>
4949

5050
<div class="editor-label">
51-
@Html.LabelFor(model => model.PublisherName)
51+
@Html.LabelFor(model => model.PublisherId)
5252
</div>
5353
<div class="editor-field">
54-
@Html.EditorFor(model => model.PublisherName)
55-
@Html.ValidationMessageFor(model => model.PublisherName)
54+
@Html.DropDownListFor(model => model.PublisherId, Model.Publishers)
5655
</div>
5756

5857
<div class="editor-label">

Views/Publisher/Details.cshtml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@model BookShopInventoryApp.Models.PublisherModel
2+
3+
@{
4+
ViewBag.Title = "Publisher Details";
5+
}
6+
7+
<h2>Details</h2>
8+
9+
<fieldset>
10+
<legend>PublisherModel</legend>
11+
12+
<div class="display-label">
13+
@Html.DisplayNameFor(model => model.Name)
14+
</div>
15+
<div class="display-field">
16+
@Html.DisplayFor(model => model.Name)
17+
</div>
18+
19+
<div class="display-label">
20+
@Html.DisplayNameFor(model => model.Year)
21+
</div>
22+
<div class="display-field">
23+
@Html.DisplayFor(model => model.Year)
24+
</div>
25+
26+
<div class="display-label">
27+
@Html.DisplayNameFor(model => model.Address)
28+
</div>
29+
<div class="display-field">
30+
@Html.DisplayFor(model => model.Address)
31+
</div>
32+
33+
<div class="display-label">
34+
@Html.DisplayNameFor(model => model.PhoneNumber)
35+
</div>
36+
<div class="display-field">
37+
@Html.DisplayFor(model => model.PhoneNumber)
38+
</div>
39+
</fieldset>
40+
<p>
41+
@Html.ActionLink("Edit", "Edit", new { id=Model.Id }) |
42+
@Html.ActionLink("Back to List", "Index")
43+
</p>

bin/BookShopInventoryApp.dll

0 Bytes
Binary file not shown.

bin/BookShopInventoryApp.pdb

0 Bytes
Binary file not shown.

obj/Debug/BookShopInventoryApp.dll

0 Bytes
Binary file not shown.

obj/Debug/BookShopInventoryApp.pdb

0 Bytes
Binary file not shown.
10 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)