提交 62ff1963 编写于 作者: 大•虫 提交者: weichunjie

Url格式化

......@@ -14,17 +14,16 @@ namespace Blog.Web
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Articles",
url: "Articles/{action}/{id}",
defaults: new { controller = "Articles", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "gl",
url: "gl/{action}/{id}",
defaults: new { controller = "Manger", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "ArticleList",
url: "{Category}/Articles/{Page}",
defaults: new { controller = "Home", action = "Articles", Category = UrlParameter.Optional, Page = UrlParameter.Optional }
);
routes.MapRoute(
name: "Home",
url: "{action}/{id}",
......
......@@ -181,7 +181,7 @@
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\UnityConfig.cs" />
<Compile Include="Controllers\ArticlesController.cs" />
<Compile Include="Controllers\ArticleController.cs" />
<Compile Include="Controllers\FileController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\LinkController.cs" />
......@@ -223,7 +223,8 @@
<Content Include="Views\Link\Index.cshtml" />
<Content Include="Views\Tag\Index.cshtml" />
<Content Include="Views\File\Index.cshtml" />
<Content Include="Views\Articles\Index.cshtml" />
<Content Include="Views\Article\Index.cshtml" />
<Content Include="Views\Home\Articles.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
......
......@@ -6,7 +6,7 @@ using System.Web.Mvc;
namespace Blog.Web.Controllers
{
public class ArticlesController : Controller
public class ArticleController : Controller
{
// GET: Article
public ActionResult Index()
......
......@@ -21,6 +21,11 @@ namespace Blog.Web.Controllers
return View();
}
public ActionResult Articles(string Category, int Page=1)
{
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
......

@{
ViewBag.Title = "Articles";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Articles</h2>
......@@ -22,6 +22,11 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("首页", "Index", "Home")</li>
<li>@Html.ActionLink("生活日记", "Articles", new { Category = "Life" })</li>
<li>@Html.ActionLink("工作笔记", "Articles", new { Category = "Work" })</li>
<li>@Html.ActionLink("技术分享", "Articles", new { Category = "Tech" })</li>
<li>@Html.ActionLink("摄影相册", "Articles", new { Category = "Xc" })</li>
<li>@Html.ActionLink("软件工具", "Articles", new { Category = "Soft" })</li>
<li>@Html.ActionLink("关于", "About", "Home")</li>
<li>@Html.ActionLink("联系方式", "Contact", "Home")</li>
</ul>
......
#MVC5ϵͳ
## Ŀܹ
### ASP.NETMVC5 +Unity +SugarSql
\ No newline at end of file
#MVC5博客系统
## 项目框架结构
### ASP.NETMVC5 +Unity +SugarSql
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册