ASP.NET MVC 简易在线书店

 写这篇博客的目的是为了记录自己的思想,有时候做项目做着做着就不知道下面该做什么了,把项目的具体流程记录下来,培养好习惯。

 创建MVC项目

 

 创建控制器StoreController

public class StoreController : Controller
{
}

添加书籍类别动作Index

public ActionResult Index()
{
       return View();
}

根据书籍类别编号显示书籍Browse

public ActionResult Browse(int id)
{
      //根据类别id获取书籍
      return View(_categoryRepository.GetCategoriesById(id));
}

根据书籍Id获取书籍详细信息Details

public ActionResult Details(int id)
{
     //根据书籍id获取详细书籍信息
     return View(_categoryRepository.GetBooksById(id));
}

创建实体数据模型

原文地址:https://www.cnblogs.com/772933011qq/p/4461285.html