码迷,mamicode.com
首页 >  
搜索关键字:actionresult    ( 581个结果
013. MVC5过滤器
微软提供了4中过滤器: 1.Action过滤器: 在Action方法执行之前和Action方法执行之后, 会执行此过滤器中的代码. 比如在执行public ActionResult Index()方法之前或之后; 也可以说是在方法执行前或执行后; 接口: IactionFilter 抽象类名: Ac ...
分类:Web程序   时间:2017-02-19 00:22:15    阅读次数:686
asp.net mvc 微软异步请求
public ActionResult GetDateTime(string userName,int age) { System.Threading.Thread.Sleep(2000); return Content(DateTime.Now.ToString() + userName + ag... ...
分类:Web程序   时间:2017-02-17 23:43:19    阅读次数:313
Asp.Net MVC Identity 2.2.1 使用技巧(七)
创建角色管理相关视图 1、添加视图 打开RolesAdminController.cs 将鼠标移动到public ActionResult Index()上 右键》添加视图 系统会弹出对话框 什么也不用改 直接“确定”。 2、在创建的视图上添加数据模型 在第一行添加 @model IEnumerab ...
分类:Web程序   时间:2017-02-13 00:10:53    阅读次数:383
Asp.Net MVC Identity 2.2.1 使用技巧(五)
创建用户管理相关视图 1、添加视图 打开UsersAdminController.cs 将鼠标移动到public ActionResult Index()上 右键》添加视图 系统会弹出对话框 什么也不用改 直接“添加”。 2、在创建的视图上添加数据模型 在第一行添加 @model IEnumerab ...
分类:Web程序   时间:2017-02-12 18:45:27    阅读次数:218
FE+MVC分页
public ActionResult Create() { return View(); } [HttpPost] public ActionResult Create(Books book) { book.CreateDate = DateTime.Now; ... ...
分类:Web程序   时间:2017-02-07 16:33:25    阅读次数:275
C# NPOI的数据批量导入数据库
public ActionResult Upload(HttpPostedFileBase Namefile) { //判断文件是否存在 if (Namefile == null) { return Content("没有文件"); } //获取上传文件的名称,位置 var fileName = D ...
分类:数据库   时间:2017-01-22 17:48:22    阅读次数:280
使用NPOI将数据库里信息导出Excel表格并提示用户下载
使用NPOI进行导出Excel表格大家基本都会,我在网上却很少找到导出Excel表格并提示下载的 简单的代码如下 1 //mvc项目可以传多个id以逗号相隔的字符串 2 public ActionResult execl(string ids) 3 { 4 List<PayLog> list = n ...
分类:数据库   时间:2017-01-10 13:14:50    阅读次数:222
C# MVC 自定义ActionResult实现EXCEL下载
前言 在WEB中,经常要使用到将数据转换成EXCEL,并进行下载。这里整理资料并封装了一个自定义ActionResult类,便于使用。如果文章对你有帮助,请点个赞。 话不多少,这里转换EXCEL使用的NPOI。还是用了一下反射的知识,便于识别实体类的一些自定义特性。 一、自定义一个Attribute ...
分类:Windows程序   时间:2016-12-20 13:48:02    阅读次数:330
ObjectStateManager 中已存在具有同一键的对象。ObjectStateManager 无法跟踪具有相同键的多个对象
程序代码 [HttpPost]public ActionResult Edit(Person person){ if (ModelState.IsValid) { Person oldperson = db.People.Where(p => p.Id == person.Id).FirstOrDe ...
分类:其他好文   时间:2016-12-06 20:42:21    阅读次数:134
MVC的多表单
中心思想就是在一个表单内不规定”action“,在js里面用@Url.Axtion("视图层","控制器")方法来设置表单的传值。 控制器 public ActionResult Jia(string a1, string a2) { int end = Convert.ToInt32(a1) + ...
分类:Web程序   时间:2016-12-06 14:25:11    阅读次数:190
581条   上一页 1 ... 15 16 17 18 19 ... 59 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!