public ActionResult EditClass(int id) { TrainEditClassViewData viewData = new TrainEditClassViewData(); Classes classes = (from c in CQGJ.Classes where c.ClassID == id select c).First(); if (Request.RequestType == "POST") { classes.ClassName = GetString("className"); classes.SubClassName = GetString("subClassName"); classes.ClassTerm = GetString("ClassTerm"); classes.TrainObject = GetString("subClassName"); classes.TrainPlace = GetString("TrainPlace"); classes.TrainSubject = GetString("TrainSubject"); classes.BeginDate = GetDate("BeginDate"); classes.EndDate = GetDate("EndDate"); classes.TrainSubject = GetString("TrainSubject"); classes.TrainContent = GetString("TrainContent"); classes.Status = GetInt("status"); classes.TrainDay = GetInt("TrainDay"); classes.HeadTeacher = GetString("HeadTeacher"); classes.Leader = GetString("Leader"); CQGJ.SaveChanges(); return RedirectToAction("showclass/" + id, "train"); } viewData.Classes = classes; return View("EditClass", viewData); }
public void EditClass(int id) { TrainEditClassViewData viewData = new TrainEditClassViewData(); Classes classes = (from c in CQGJ.Classes where c.ClassID == id select c).First(); if (GetString("className") != "") { classes.ClassName = GetString("className"); classes.SubClassName = GetString("subClassName"); classes.ClassTerm = GetString("ClassTerm"); classes.TrainObject = GetString("subClassName"); classes.TrainPlace = GetString("TrainPlace"); classes.TrainSubject = GetString("TrainSubject"); classes.BeginDate = GetDate("BeginDate"); classes.EndDate = GetDate("EndDate"); classes.TrainSubject = GetString("TrainSubject"); classes.TrainContent = GetString("TrainContent"); classes.Status = GetInt("status"); CQGJ.SaveChanges(); RedirectToAction("showclass/" + id, "train"); } viewData.Classes = classes; RenderView("EditClass", viewData); }