diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs index 9b262ee..f4722e0 100644 --- a/Controllers/HomeController.cs +++ b/Controllers/HomeController.cs @@ -13,6 +13,8 @@ namespace WebApplication1.Controllers public ActionResult Index() { + ViewBag.newsCount = db.news.Count(); + ViewBag.views = ""; setTitle(); return View(); } diff --git a/Views/Home/Index.cshtml b/Views/Home/Index.cshtml index f1948a7..e26b0d2 100644 --- a/Views/Home/Index.cshtml +++ b/Views/Home/Index.cshtml @@ -10,14 +10,14 @@
-
-

Getting started

+
+

News count

- ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that - enables a clean separation of concerns and gives you full control over markup - for enjoyable, agile development. + @ViewBag.newsCount +

+

+ Start Reading »

-

Learn more »

Get more libraries

diff --git a/Views/news/Latest.cshtml b/Views/news/Latest.cshtml new file mode 100644 index 0000000..9f65eaa --- /dev/null +++ b/Views/news/Latest.cshtml @@ -0,0 +1,52 @@ +@model IEnumerable + +

+ @Html.ActionLink("Create New", "Create") +

+ + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + + + } + +
+ @Html.DisplayNameFor(model => model.title) + + category + + @Html.DisplayNameFor(model => model.tag) + + @Html.DisplayNameFor(model => model.publishDate) + + @Html.DisplayNameFor(model => model.views) +
+ @Html.DisplayFor(modelItem => item.title) + + @Html.DisplayFor(modelItem => item.cat) + + @Html.DisplayFor(modelItem => item.tag) + + @Html.DisplayFor(modelItem => item.publishDate) + + @Html.DisplayFor(modelItem => item.views) + + @Html.ActionLink("Edit", "Edit", new { id = item.ID }) | + @Html.ActionLink("Details", "Details", new { id = item.ID }) | + @Html.ActionLink("Delete", "Delete", new { id = item.ID }) +
diff --git a/WebApplication1.csproj b/WebApplication1.csproj index e5d1016..9d918dc 100644 --- a/WebApplication1.csproj +++ b/WebApplication1.csproj @@ -275,6 +275,7 @@ +