// GET: Home //public ActionResult profile() //{ // //AspNetUser Aspuser =new // // (from c in db.AspNetUsers // // where c.Id == User.Identity.GetUserId() // // select c).ToList(); // return View(); //} public ActionResult About() { ViewBag.Message = "The generation done successfully"; CollegeDatabaseEntities10 _db = new CollegeDatabaseEntities10(); var del = (from x in db.LectureTimes select x); db.LectureTimes.RemoveRange(del); var dell = (from x in db.SectionTimes select x); db.SectionTimes.RemoveRange(dell); // var res = functions.Generatelecandsec() List <GroupModel> GrpList = new List <GroupModel>(); functions func = new functions(); var res = func.Generate_lect(ref GrpList); var assin = func.generatesecs(GrpList); var lecTimeTable = new LectureTime(); foreach (var item in res) { var crs_id = _db.Courses.Where(x => x.Name == item.CourseName).Select(x => x.ID).Single(); lecTimeTable = new LectureTime() { Course_id = crs_id, Room_id = item.RoomId, DayOfWeek = item.Day, Grp_id = item.GrpId, StartHour = item.StartHour }; _db.LectureTimes.Add(lecTimeTable); _db.SaveChanges(); Console.WriteLine("{0} : {1} : {2}", item.CourseName, item.StartHour, item.Day.ToString()); } foreach (var item in assin) { if (item.RoomId != -1) { SectionTime x = new SectionTime(); x.Course_id = item.CourseId; x.Section_id = item.SectionId; x.Room_id = item.RoomId; x.DayOfWeek = item.Day; x.StartHour = item.Start; x.isLab = item.IsLab; x.isSection = item.IsSection; // if(item.Tasids) x.Ta_id = item.Tasids[0]; _db.SectionTimes.Add(x); _db.SaveChanges(); } } return(View()); }