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 @@
- 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 +
+ -+ @Html.ActionLink("Create New", "Create") +
+| + @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 }) + | +