public ActionResult Edit(CoursesArranging ca) { if ((string)Session["Power"] != "1") { return(Json("0")); } ClasstimeDal.Edit(ca); return(Json(ClasstimeDal.List())); }
public static void Add(CoursesArranging ca) { using (var db = new XuejiContext()) { var coursesarranging = new CoursesArranging { ClassesId = ca.ClassesId, CoursesId = ca.CoursesId, WeekArrangingId = ca.WeekArrangingId, WeekStart = ca.WeekStart, WeekEnd = ca.WeekEnd, LessonsOrder = ca.LessonsOrder, ClassroomId = ca.ClassroomId, WeekDays = ca.WeekDays }; db.CoursesArrangings.Add(coursesarranging); db.SaveChanges(); } }
public static void Edit(CoursesArranging coursesarranging) { using (var db = new XuejiContext()) { var single = db.CoursesArrangings.SingleOrDefault(ca => ca.Id == coursesarranging.Id); if (single != null) { single.ClassesId = coursesarranging.ClassesId; single.CoursesId = coursesarranging.CoursesId; single.WeekArrangingId = coursesarranging.WeekArrangingId; single.WeekStart = coursesarranging.WeekStart; single.WeekEnd = coursesarranging.WeekEnd; single.LessonsOrder = coursesarranging.LessonsOrder; single.ClassroomId = coursesarranging.ClassroomId; single.WeekDays = coursesarranging.WeekDays; } db.SaveChanges(); } }