[HttpPost] //这里没问题 public ActionResult SaveInformation() { HttpCookie CurrCookie = Request.Cookies["user_id"]; int NUM = Convert.ToInt32(CurrCookie.Value); borrowInformation borrowInformations = new borrowInformation(); borrowInformations.单位名称 = Request["单位名称"]; borrowInformations.借用机房 = Request["借用机房"]; borrowInformations.借用人 = Request["借用人"]; borrowInformations.借用人身份 = Request["借用人身份"]; borrowInformations.具体内容描述 = Request["具体内容描述"]; borrowInformations.联系电话 = Request["联系电话"]; borrowInformations.其它 = Request["其它"]; borrowInformations.所在班级 = Request["所在班级"]; borrowInformations.提交时间 = DateTime.Now; borrowInformations.批准时间 = DateTime.Now; borrowInformations.学号 = Request["学号"]; borrowInformations.用途 = Request["用途"]; borrowInformations.借用具体时间始 = Request["借用具体时间始"]; borrowInformations.借用具体时间终 = Request["借用具体时间终"]; borrowInformations.user_id = NUM; borrowInformationContext iContext = new borrowInformationContext(); iContext.borrowInformations.Add(borrowInformations); iContext.SaveChanges(); return(RedirectToAction("checking", "borrowInformation")); }
public ActionResult Update1() { HttpCookie CurrCookie = Request.Cookies["information_id"]; int NUM = Convert.ToInt32(CurrCookie.Value); borrowInformation _borrowInformation = db.borrowInformations.SingleOrDefault(u => u.information_id == NUM); _borrowInformation.负责人意见 = Request["负责人意见"]; _borrowInformation.系领导意见 = Request["系领导意见"]; _borrowInformation.informationCategory = 1; db.Entry <borrowInformation>(_borrowInformation).State = System.Data.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("inforCheck", "Check")); }