随笔分类 -  MVC

摘要:路由控制器指向Home 控制器中没有Home 就会404 , 或者更改控制器指向名字 跳转到区域下的控制器 阅读全文
posted @ 2018-06-29 17:09 enych 阅读(118) 评论(0) 推荐(0)
摘要:System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(""); sb.Append(""); sb.Append(""); sb.Append(""); sb.Append("")... 阅读全文
posted @ 2018-06-21 18:29 enych 阅读(500) 评论(0) 推荐(0)
摘要:测试结果 阅读全文
posted @ 2018-06-01 21:49 enych 阅读(3073) 评论(0) 推荐(0)
摘要:ViewBag.model = bLL.GetModel((int)id); ViewBag.RecruitmentTime = ViewBag.model.RecruitmentTime.ToString("yyyy-MM-dd"); //格式化返回前台输出的时间 retur... 阅读全文
posted @ 2018-04-09 09:41 enych 阅读(339) 评论(0) 推荐(0)
摘要:public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); //routes.MapRout... 阅读全文
posted @ 2018-04-03 17:21 enych 阅读(255) 评论(0) 推荐(0)
摘要:页面加载顺序 先加载 阅读全文
posted @ 2018-03-29 09:51 enych 阅读(310) 评论(0) 推荐(0)
摘要:后台代码 阅读全文
posted @ 2018-03-24 11:51 enych 阅读(1668) 评论(0) 推荐(0)
摘要:这样能请求home下的updateA函数 这样能请求home下的update函数,不能请求updateA函数 阅读全文
posted @ 2018-03-14 10:23 enych 阅读(146) 评论(0) 推荐(0)
摘要:[HttpPost] public ActionResult Layedit() { var files = Request.Files; //获得所上传的所有文件 if (files.Count > 0) { HttpPostedFileBase fil... 阅读全文
posted @ 2018-03-07 15:16 enych 阅读(294) 评论(0) 推荐(0)
摘要:使用 return Json(pageList, JsonRequestBehavior.AllowGet); 返回object 使用 return Content(JsonConvert.SerializeObject(pageList, timeConverter)); //返回json字符串 阅读全文
posted @ 2018-03-07 15:05 enych 阅读(287) 评论(0) 推荐(0)
摘要://(1)返回filestream 其中:“text/plain”是文件MIME类型 public FileStreamResult download() { string fileName = "aaa.txt";//客户端保存的文件名 string filePath = Server.MapP... 阅读全文
posted @ 2018-01-25 16:03 enych 阅读(301) 评论(0) 推荐(0)
摘要:if (file != null) { string path = Server.MapPath("~/Uploads/"); //获得服务器物理路径 if (!System.IO.Directory.Exists(path))//判断目录是否存在 ... 阅读全文
posted @ 2018-01-25 15:17 enych 阅读(224) 评论(0) 推荐(0)
摘要:public ActionResult Index(string id)//主页 //参数string searchString 访问方式为index?searchString=xxxx 。参数string id 访问方式为index/x { string searchString = id; //return View... 阅读全文
posted @ 2018-01-09 17:54 enych 阅读(434) 评论(0) 推荐(0)
摘要:return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //HttpStatusCode statusCode 枚举 // HttpStatusCode.BadRequest = 400, public HttpStatusCodeResult(HttpStatusCode statusCode);//带参的构造函数 Htt... 阅读全文
posted @ 2018-01-09 17:17 enych 阅读(189) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2018-01-09 11:15 enych 阅读(266) 评论(0) 推荐(0)
摘要:模板(在Views下新建文件夹Shared;在Shared下新建模板页) 子页面(在views文件夹下新建视图_ViewStart) 阅读全文
posted @ 2018-01-08 11:44 enych 阅读(144) 评论(0) 推荐(0)
摘要:public class HomeController : Controller { // GET: Home public ActionResult Index() //控制器名Home下默认的一个方法 { return View();//返回视图 } [HttpPost]//表单... 阅读全文
posted @ 2018-01-08 11:05 enych 阅读(224) 评论(0) 推荐(0)
摘要:IIS服务器web核心没有安装造成的 阅读全文
posted @ 2018-01-08 10:29 enych 阅读(244) 评论(0) 推荐(0)
摘要://查询 //查询指定字符串出现的个数,类似于模糊查询select count(*) from Book where Name like '%字符串%' db.Book.Where(x => x.Name.Contains(txtName.Text.Trim())).Count(); //接收查询的数据 List bk = db.Book.ToList(); dataGridView1.... 阅读全文
posted @ 2018-01-07 22:10 enych 阅读(159) 评论(0) 推荐(0)
摘要:删除方法 阅读全文
posted @ 2017-12-13 08:25 enych 阅读(190) 评论(0) 推荐(0)