Skip to content

Commit affbcf9

Browse files
committed
publisher model fix
1 parent db1f29a commit affbcf9

File tree

54 files changed

+142
-58454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+142
-58454
lines changed

BookShopInventoryApp.v12.suo

20 KB
Binary file not shown.

Controllers/PublisherController.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public ActionResult Index()
2929
{
3030
Id = publisherData.Id,
3131
Name = publisherData.Name,
32-
Year = Convert.ToInt32(publisherData.Year)
32+
Address = publisherData.Address,
33+
PhoneNumber = Convert.ToInt32(publisherData.PhoneNumber)
34+
// Year = Convert.ToInt32(publisherData.Year)
3335
});
3436
}
3537
return View(publisherList);
@@ -49,7 +51,9 @@ public ActionResult Create(PublisherModel model)
4951
Publisher publisher = new Publisher()
5052
{
5153
Name = model.Name,
52-
Year = model.Year.ToString()
54+
Address = model.Address,
55+
PhoneNumber = model.PhoneNumber
56+
//Year = model.Year.ToString()
5357
};
5458
context.Publishers.InsertOnSubmit(publisher);
5559
context.SubmitChanges();

Models/BookModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ public BookModel()
2323
public int PublisherId { get; set; }
2424
public string PublisherName { get; set; }
2525
public IEnumerable<SelectListItem> Publishers { get; set; }
26+
public int ISBN { get; set; }
27+
public int StockLevel { get; set; }
2628
}
2729
}

Models/Operation.dbml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
<Type Name="Publisher">
55
<Column Name="Id" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
66
<Column Name="Name" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
7-
<Column Name="Year" Type="System.String" DbType="NVarChar(4) NOT NULL" CanBeNull="false" />
7+
<Column Name="Year" Type="System.String" DbType="NVarChar(4)" CanBeNull="true" />
8+
<Column Name="Address" Type="System.String" DbType="NVarChar(MAX) NOT NULL" CanBeNull="false" />
9+
<Column Name="PhoneNumber" Type="System.Int32" DbType="Int" CanBeNull="true" />
810
<Association Name="Publisher_BOOK" Member="BOOKs" ThisKey="Id" OtherKey="PublisherId" Type="BOOK" />
911
</Type>
1012
</Table>
@@ -16,6 +18,8 @@
1618
<Column Name="Year" Type="System.String" DbType="NVarChar(4) NOT NULL" CanBeNull="false" />
1719
<Column Name="Price" Type="System.Decimal" DbType="Decimal(6,2) NOT NULL" CanBeNull="false" />
1820
<Column Name="PublisherId" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
21+
<Column Name="ISBN" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
22+
<Column Name="StockLevel" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
1923
<Association Name="Publisher_BOOK" Member="Publisher" ThisKey="PublisherId" OtherKey="Id" Type="Publisher" IsForeignKey="true" DeleteRule="CASCADE" DeleteOnNull="true" />
2024
</Type>
2125
</Table>

Models/Operation.dbml.layout

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
<ordesignerObjectsDiagram dslVersion="1.0.0.0" absoluteBounds="0, 0, 11, 8.5" name="Operation">
33
<DataContextMoniker Name="/OperationDataContext" />
44
<nestedChildShapes>
5-
<classShape Id="beb69990-9ed3-4456-a265-1ea2a9171227" absoluteBounds="1, 1.75, 2, 1.3862939453125">
5+
<classShape Id="c6adfa12-4cd0-4946-a74f-eedb092b022b" absoluteBounds="1, 1.25, 2, 1.7708968098958331">
66
<DataClassMoniker Name="/OperationDataContext/Publisher" />
77
<nestedChildShapes>
8-
<elementListCompartment Id="215ce914-65e9-45cd-97e3-873a1a73af5f" absoluteBounds="1.0150000000000001, 2.21, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
8+
<elementListCompartment Id="2eb8c8b8-a014-482f-a9a8-7ffc3a44bd56" absoluteBounds="1.0149999999999997, 1.71, 1.9700000000000002, 1.2108968098958333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
99
</nestedChildShapes>
1010
</classShape>
11-
<classShape Id="ae8f20f6-21a9-4358-900d-ec5392869d6f" absoluteBounds="4.375, 1.75, 2, 1.9631982421875">
11+
<classShape Id="f920f891-3249-4e5c-8048-b2215f7217b7" absoluteBounds="4.625, 1.375, 2, 2.3478011067708335">
1212
<DataClassMoniker Name="/OperationDataContext/BOOK" />
1313
<nestedChildShapes>
14-
<elementListCompartment Id="1ab4fa11-af2a-40cc-8414-be0fd7137926" absoluteBounds="4.39, 2.21, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
14+
<elementListCompartment Id="00d8b5c0-f996-4306-b9eb-e28f3a8c742b" absoluteBounds="4.64, 1.835, 1.9700000000000002, 1.7878011067708335" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
1515
</nestedChildShapes>
1616
</classShape>
17-
<associationConnector edgePoints="[(3 : 2.44314697265625); (4.375 : 2.44314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
17+
<associationConnector edgePoints="[(3 : 2.19794840494792); (4.625 : 2.19794840494792)]" fixedFrom="Algorithm" fixedTo="Algorithm">
1818
<AssociationMoniker Name="/OperationDataContext/Publisher/Publisher_BOOK" />
1919
<nodes>
20-
<classShapeMoniker Id="beb69990-9ed3-4456-a265-1ea2a9171227" />
21-
<classShapeMoniker Id="ae8f20f6-21a9-4358-900d-ec5392869d6f" />
20+
<classShapeMoniker Id="c6adfa12-4cd0-4946-a74f-eedb092b022b" />
21+
<classShapeMoniker Id="f920f891-3249-4e5c-8048-b2215f7217b7" />
2222
</nodes>
2323
</associationConnector>
2424
</nestedChildShapes>

Models/Operation.designer.cs

Lines changed: 97 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Models/PublisherModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ public class PublisherModel
1010
public int Id { get; set; }
1111
public string Name { get; set; }
1212
public int Year { get; set; }
13+
public string Address { get; set; }
14+
public int PhoneNumber { get; set; }
1315
}
1416
}

Views/Publisher/Create.cshtml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@model BookShopInventoryApp.Models.PublisherModel
22

33
@{
4-
ViewBag.Title = "Create";
4+
ViewBag.Title = "Create Publisher";
55
}
66

7-
<h2>Create</h2>
7+
<h2>Add a new Publisher</h2>
88

99
@using (Html.BeginForm()) {
1010
@Html.AntiForgeryToken()
@@ -22,11 +22,19 @@
2222
</div>
2323

2424
<div class="editor-label">
25-
@Html.LabelFor(model => model.Year)
25+
@Html.LabelFor(model => model.Address)
2626
</div>
2727
<div class="editor-field">
28-
@Html.EditorFor(model => model.Year)
29-
@Html.ValidationMessageFor(model => model.Year)
28+
@Html.EditorFor(model => model.Address)
29+
@Html.ValidationMessageFor(model => model.Address)
30+
</div>
31+
32+
<div class="editor-label">
33+
@Html.LabelFor(model => model.PhoneNumber)
34+
</div>
35+
<div class="editor-field">
36+
@Html.EditorFor(model => model.PhoneNumber)
37+
@Html.ValidationMessageFor(model => model.PhoneNumber)
3038
</div>
3139

3240
<p>

Views/Publisher/Index.cshtml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@model IEnumerable<BookShopInventoryApp.Models.PublisherModel>
22

33
@{
4-
ViewBag.Title = "Index";
4+
ViewBag.Title = "Publishers";
55
}
66

7-
<h2>Index</h2>
7+
<h2>Publishers</h2>
88

99
<p>
1010
@Html.ActionLink("Create New", "Create")
@@ -15,9 +15,11 @@
1515
@Html.DisplayNameFor(model => model.Name)
1616
</th>
1717
<th>
18-
@Html.DisplayNameFor(model => model.Year)
18+
@Html.DisplayNameFor(model => model.Address)
19+
</th>
20+
<th>
21+
@Html.DisplayNameFor(model => model.PhoneNumber)
1922
</th>
20-
<th></th>
2123
</tr>
2224

2325
@foreach (var item in Model) {
@@ -26,7 +28,10 @@
2628
@Html.DisplayFor(modelItem => item.Name)
2729
</td>
2830
<td>
29-
@Html.DisplayFor(modelItem => item.Year)
31+
@Html.DisplayFor(modelItem => item.Address)
32+
</td>
33+
<td>
34+
@Html.DisplayFor(modelItem => item.PhoneNumber)
3035
</td>
3136
<td>
3237
@Html.ActionLink("Edit", "Edit", new { id=item.Id }) |

bin/BookShopInventoryApp.dll

1.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)