/// <summary> /// Deprecated Method for adding a new object to the Classes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToClasses(Class @class) { base.AddObject("Classes", @class); }
public ActionResult Schedule(itmmSchedule a, string room, int AvailableTable, string[] Days) { Class b = new Class(); b.GroupNo = a.GroupNo; b.CourseCode = a.CourseCode; b.CourseDescription = a.CourseDesc; //b.Day = a.Day b.Day = FormatDays(Days); b.Schedule = a.Schedule; b.Instructor = a.Instructor; b.AvailableTable = AvailableTable; b.Room = room; b.LabId = getLabId(); con.AddToClasses(b); con.SaveChanges(); int lastInsertedClassId = b.ClassId; for (int i = 1; i <= AvailableTable; i++) { Table c = new Table(); c.ClassId = b.ClassId; c.TableNo = i; con.AddToTables(c); } con.SaveChanges(); return RedirectToAction("Schedule"); }
/// <summary> /// Create a new Class object. /// </summary> /// <param name="classId">Initial value of the ClassId property.</param> /// <param name="groupNo">Initial value of the GroupNo property.</param> /// <param name="courseCode">Initial value of the CourseCode property.</param> /// <param name="courseDescription">Initial value of the CourseDescription property.</param> /// <param name="day">Initial value of the Day property.</param> /// <param name="schedule">Initial value of the Schedule property.</param> /// <param name="room">Initial value of the Room property.</param> /// <param name="instructor">Initial value of the Instructor property.</param> /// <param name="labId">Initial value of the LabId property.</param> public static Class CreateClass(global::System.Int32 classId, global::System.Int32 groupNo, global::System.String courseCode, global::System.String courseDescription, global::System.String day, global::System.String schedule, global::System.String room, global::System.String instructor, global::System.Int32 labId) { Class @class = new Class(); @class.ClassId = classId; @class.GroupNo = groupNo; @class.CourseCode = courseCode; @class.CourseDescription = courseDescription; @class.Day = day; @class.Schedule = schedule; @class.Room = room; @class.Instructor = instructor; @class.LabId = labId; return @class; }