Exemplo n.º 1
0
        public ActionResult CreateSemester(string[] semesterId, string[] start, string[] finish)
        {
            Service.Service service = new Service.Service();

            var classes = from c in db.Classes
                           where c.ActiveSchemes.Count < c.Education.Semesters.Count
                           select c;

            foreach (var item in classes)
            {
                List<Semester> semesters = (from s in item.Education.Semesters
                                            select s).ToList();

                int semesterNumber = item.ActiveSchemes.Count;

                service.setNewSemesterForClass(item, semesters[semesterNumber], Convert.ToDateTime(start[semesterNumber]), Convert.ToDateTime(finish[semesterNumber]));
            }

            db.SaveChanges();
            return RedirectToAction("Index");
        }