温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net3.5 MVC入门之文章管理源码
1using System; 2
using System.Collections.Generic; 3
using System.Linq; 4
using System.Web; 5
using System.Web.Mvc; 6
7
namespace MvcArticleDemo.Controllers 8
{ 9
public class HomeController : Controller 10
{ 11
Models.ArticleDemoDataContext articleDc = new MvcArticleDemo.Models.ArticleDemoDataContext(); 12
public Object Index() 13
{ 14
// ViewData["Title"] = "Home Page"; 15
//ViewData["Message"] = "Welcome to ASP.NET MVC!"; 16
17
18
return View("Index", articleDc.Categories.ToList()); 19
} 20
21
public ActionResult About() 22
{ 23
ViewData["Title"] = "About Page"; 24
25
return View(); 26
} 27
} 28
} 29





}
}