zoukankan      html  css  js  c++  java
  • MVC视图与控制器分离简单描述

    一,控制器

    CheckIndexAreaRegistration.cs
    
    public class CheckIndexAreaRegistration : AreaRegistration
        {
            public override string AreaName
            {
                get
                {
                    return "CheckIndex";
                }
            }
    
            public override void RegisterArea(AreaRegistrationContext context)
            {
                context.MapRoute(
                    "CheckIndex_default",
                    "CheckIndex/{controller}/{action}/{id}",
                    new { action = "Index", id = UrlParameter.Optional },
                new string[] { typeof(CheckIndexAreaRegistration).Namespace } //增加此行,不然会出现controller命名重复的exception
                );
            }
        }
    
    ShowAllController.cs
    
     public class ShowAllController : BaseController
        {
            [SkipRole]
            public ActionResult Index()
            {
                return View();
            }
        }
    

    二,视图

  • 相关阅读:
    php基础
    MYSQL 常用函数
    MYSQL 练习题
    MYSQL 查询
    MYSQL:增删改
    隐藏导航
    分层导航
    图片轮播!
    你帅不帅?
    PHP 流程
  • 原文地址:https://www.cnblogs.com/Aamir-Ye/p/4611968.html
Copyright © 2011-2022 走看看