zoukankan      html  css  js  c++  java
  • .Net MVC小尝试

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace mvcDemo.Controllers
    {
        public class StoreController : Controller
        {
            // GET: Store
            public string Index()
            {
                return "Hello from Store.Index()";
            }
    
            // GET: Store
            public string Browse()
            {
                return "Hello from Store.Browse()";
            }
    
            // GET: Store
            public string Details()
            {
                return "Hello from Store.Details()";
            }
        }
    }
    

    在浏览器地址后面输入"/Store/Index"
    就能看到返回的字符串数据了。

    传递参数,

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace mvcDemo.Controllers
    {
        public class StoreController : Controller
        {
            // GET: Store
            public string Index()
            {
                return "Hello from Store.Index()";
            }
    
            // GET: Store
            public string Browse(string genre)
            {
                string message = HttpUtility.HtmlEncode("Genre =" +genre);
                return message;
            }
    
            // GET: Store
            public string Details()
            {
                return "Hello from Store.Details()";
            }
        }
    }
    

    新的传递方式

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace mvcDemo.Controllers
    {
        public class StoreController : Controller
        {
            // GET: Store
            public string Index()
            {
                return "Hello from Store.Index()";
            }
    
            // GET: Store
            public string Browse(string genre)
            {
                string message = HttpUtility.HtmlEncode("Genre =" +genre);
                return message;
            }
    
            // GET: Store
            public string Details(int id)
            {
                string message = "Store.Details,ID = " + id;
                return message;
            }
        }
    }
    
  • 相关阅读:
    oracle体系结构
    Oracle表连接(转)
    Oracle的RBO和CBO
    Linux下安装Tomcat服务器和部署Web应用
    动态创建selectjs 操作select和option
    JS中如何获取<Select>中value和text的值
    原生JavaScript事件详解
    动态添加select的option
    js 动态加载事件的几种方法总结
    js实现select动态添加option
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/6874716.html
Copyright © 2011-2022 走看看