Categories { get; set; }
27 | }
28 | }
--------------------------------------------------------------------------------
/Books/Views/Books/BookForm.cshtml:
--------------------------------------------------------------------------------
1 | @model Books.ViewModels.BookFormViewModel
2 |
3 | @{
4 | ViewBag.Title = "Create";
5 | }
6 |
7 |
8 | @(Model.Id == 0 ? "Add New Book" : "Edit Book")
9 |
10 |
11 |
12 |
13 | @using (Html.BeginForm("Save", "Books"))
14 | {
15 | @Html.AntiForgeryToken()
16 |
17 | @Html.HiddenFor(m => m.Id)
18 |
19 |
20 | @Html.LabelFor(m => m.Title)
21 | @Html.TextBoxFor(m => m.Title, new { @class = "form-control" })
22 | @Html.ValidationMessageFor(m => m.Title, null, new { @class = "text-danger" })
23 |
24 |
25 |
26 | @Html.LabelFor(m => m.Author)
27 | @Html.TextBoxFor(m => m.Author, new { @class = "form-control" })
28 | @Html.ValidationMessageFor(m => m.Author, null, new { @class = "text-danger" })
29 |
30 |
31 |
32 | @Html.LabelFor(m => m.CategoryId)
33 | @Html.DropDownListFor(m => m.CategoryId, new SelectList(Model.Categories, "Id", "Name"), "", new { @class = "form-control" })
34 | @Html.ValidationMessageFor(m => m.CategoryId, null, new { @class = "text-danger" })
35 |
36 |
37 |
38 | @Html.LabelFor(m => m.Description)
39 | @Html.TextAreaFor(m => m.Description, new { @class = "form-control" })
40 | @Html.ValidationMessageFor(m => m.Description, null, new { @class = "text-danger" })
41 |
42 |
43 | Save
44 | }
45 |
46 | @section Scripts
47 | {
48 | @Scripts.Render("~/bundles/jqueryval")
49 | }
--------------------------------------------------------------------------------
/Books/Views/Books/Details.cshtml:
--------------------------------------------------------------------------------
1 | @model Books.Models.Book
2 |
3 | @{
4 | ViewBag.Title = "Details";
5 | }
6 |
7 |
8 |
9 | @Model.Title
10 |
11 |
12 |
13 |
14 | @Model.Author
15 | @Model.Category.Name
16 | @Model.Description
17 | @Model.AddedOn
18 |
19 |
--------------------------------------------------------------------------------
/Books/Views/Books/Index.cshtml:
--------------------------------------------------------------------------------
1 | @model IEnumerable
2 |
3 | @{
4 | ViewBag.Title = "Index";
5 | }
6 |
7 | Books
8 |
9 |
10 |
11 |
12 |
13 | Add New
14 |
15 |
16 | @TempData["Message"]
17 |
18 |
19 |
20 | No books added yet!
21 |
22 |
23 |
24 |
25 |
26 | Title
27 | Author
28 | Category
29 | Description
30 | Added On
31 | Action
32 |
33 |
34 |
35 | @foreach (var book in Model)
36 | {
37 |
38 | @Html.ActionLink(book.Title, "Details", "Books", new { id = book.Id }, null)
39 | @book.Author
40 | @book.Category.Name
41 | @book.Description
42 | @book.AddedOn
43 |
44 |
45 |
46 | Edit
47 |
48 |
49 |
50 | Delete
51 |
52 |
53 |
54 | }
55 |
56 |
57 |
58 | @section Scripts
59 | {
60 |
117 | }
--------------------------------------------------------------------------------
/Books/Views/Home/About.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "About";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 | Use this area to provide additional information.
8 |
--------------------------------------------------------------------------------
/Books/Views/Home/Contact.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Contact";
3 | }
4 | @ViewBag.Title.
5 | @ViewBag.Message
6 |
7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P:
11 | 425.555.0100
12 |
13 |
14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com
17 |
--------------------------------------------------------------------------------
/Books/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewBag.Title = "Home Page";
3 | }
4 |
5 |
6 |
ASP.NET
7 |
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.
8 |
Learn more »
9 |
10 |
11 |
12 |
13 |
Getting started
14 |
15 | ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16 | enables a clean separation of concerns and gives you full control over markup
17 | for enjoyable, agile development.
18 |
19 |
Learn more »
20 |
21 |
22 |
Get more libraries
23 |
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
24 |
Learn more »
25 |
26 |
27 |
Web Hosting
28 |
You can easily find a web hosting company that offers the right mix of features and price for your applications.
29 |
Learn more »
30 |
31 |
--------------------------------------------------------------------------------
/Books/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Error
6 |
7 |
8 |
9 | Error.
10 | An error occurred while processing your request.
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Books/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewBag.Title - Books
7 | @Styles.Render("~/Content/css")
8 | @Scripts.Render("~/bundles/modernizr")
9 |
10 |
11 |
12 | Books
13 |
14 |
15 |
16 |
17 |
18 |
19 | Home (current)
20 |
21 |
22 | @Html.ActionLink("Books", "Index", "Books", null, new { @class = "nav-link" })
23 |
24 |
25 |
26 |
27 |
28 | @RenderBody()
29 |
30 |
33 |
34 |
35 | @Scripts.Render("~/bundles/jquery")
36 | @Scripts.Render("~/bundles/bootstrap")
37 | @RenderSection("scripts", required: false)
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Books/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Books/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Views/Shared/_Layout.cshtml";
3 | }
4 |
--------------------------------------------------------------------------------
/Books/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Books/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Books/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Books/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/muhammadelhelaly/Books_ASPNETMVC5/59f95a2116df2cf41647168f81e0d878a2093a50/Books/favicon.ico
--------------------------------------------------------------------------------
/Books/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------