找传奇、传世资源到传世资源站!

asp.net restful api demo

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

public class Routes : RouteSet{public override void Map(Mapper map){map.Root<HomeController>(x => x.Show());map.Path("test/{id}").To<TestController>(x => x.Test()).Constrain("id", @"\d ");map.Resource<SessionsController>();map.Resources<BlogsController>(blogs =>{blogs.As("weblogs");blogs.Only("index", "show");blogs.Collection(x => {x.Get("latest");x.Post("someaction"););blogs.Member(x => x.Put("move"));blogs.Resources<PostsController>(posts =>{posts.Except("create", "update", "destroy");posts.Resources<CommentsController>(c => c.Except("destroy"));});});}}public class MvcApplication : System.Web.HttpApplication{protected void Application_Start(){ViewEngines.Engines.Clear();ViewEngines.Engines.Add(new RestfulRoutingViewEngine());RouteTable.Routes.MapRoutes<Routes>();}}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复