plina

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2016年11月10日

摘要: MVC中经常会用到关于设置访问权限的问题: 如果我们扩展了AuthorizeAttribute,那么我们只需要在类或方法前加上此attribute,即可实现权限问题。 AttributeTargets 权限适用于类或者方法 阅读全文
posted @ 2016-11-10 17:20 plina 阅读(396) 评论(0) 推荐(0) 编辑

摘要: MVC中经常会用一些服务端对Model的验证。 服务端验证要继承自ValidationAttribute,并重写IsValid虚方法来自定义自己的验证规则。 比如上边校验字符串不能少于指定字符,否则show出来用户自定义的message。 阅读全文
posted @ 2016-11-10 17:09 plina 阅读(646) 评论(0) 推荐(0) 编辑

摘要: public class QeurySort { public static IList Sort(IList list,string sidx,string sord) { switch (sord) { case "asc": ret... 阅读全文
posted @ 2016-11-10 14:41 plina 阅读(432) 评论(0) 推荐(0) 编辑