/// <summary> /// 学生住宿信息 增删改查 视图 /// </summary> /// <returns></returns> public ActionResult ManageLiveDorm_Add( [Bind(Exclude = "IDLiveDorm")] LiveDorm_table liveDorm) { if (new OperationLiveDormData().Add(liveDorm) == 1) { return(Json(new { msg = "Successd" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { msg = "Failed" }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 形参为LiveDorm_table 对象 根据编号修改对象信息 /// </summary> /// <param name="obj"></param> public override int Modify(Object obj) { try { LiveDorm_table stu = obj as LiveDorm_table; var user = (from e in db.LiveDorm_table where e.IDLiveDorm == stu.IDLiveDorm select e).FirstOrDefault(); user = stu; db.SaveChanges(); return(1); } catch (Exception e) { return(0); } }
public void TestData3() { LiveDorm_table li = new LiveDorm_table(); li.IDStudent = 2000001; li.IDDorm = 10000002; li.OtherLiveDorm = ""; db.LiveDorm_table.Add(li); NewCourse_table asda = new NewCourse_table(); asda.IDTeacher = 300001; asda.IDSchoolhour = 3; asda.IDCourse = 500002; asda.IDClassroom = 60002; asda.SetTimeNewCourse = DateTime.Now; asda.BeginTimeNewCourse = DateTime.Now; asda.NatureNewCourse = 1; db.NewCourse_table.Add(asda); db.SaveChanges(); }