public ActionResult AddTeacher(Teacher model)
 {
     IRepositories repositories = new RepositoryFactory();
     repositories.TeacherRepository.Insert(Convert(model));
     repositories.Commit();
     return RedirectToAction("Index");
 }
Esempio n. 2
0
 public ActionResult AddItem(Item model)
 {
     IRepositories repositories = new RepositoryFactory();
     new ScheduleManager(repositories).AddItem(model.ScheduleId, ItemConvertor(model));
     repositories.Commit();
     return RedirectToAction("Schedule", new{id = model.DataId});
 }
Esempio n. 3
0
        public ActionResult AddItem(Guid? scheduleId, int dayNumber, int subgroupNumber, int order, Guid groupId)
        {
            var repositories = new RepositoryFactory();
            var scheduleManager = new ScheduleManager(repositories);
            if (scheduleId == null)
            {
                var schedule = new DBLE.Schedule
                    {
                        Id = Guid.NewGuid(),
                        Items = new List<DBLE.Item>()
                    };
                scheduleManager.AddGroupSchedule(groupId, schedule, subgroupNumber);
                repositories.Commit();

                return View(new Item
                {
                    Id = Guid.NewGuid(),
                    ScheduleId = (Guid)schedule.Id,
                    DataId = groupId,
                    Order = order,
                    NumberOfDay = dayNumber
                });
            }

            return View(new Item
                {
                    Id = Guid.NewGuid(),
                    ScheduleId = (Guid)scheduleId,
                    DataId = groupId,
                    Order = order,
                    NumberOfDay = dayNumber

                });
        }
Esempio n. 4
0
        public ActionResult AddStudent(Student model)
        {
            IRepositories repositories = new RepositoryFactory();
            DBLE.Student student = StudentConverter(model);

            student.Id = Guid.NewGuid();
            new GroupManager(repositories).AddStudent(model.GroupId, student);
            repositories.Commit();

            return RedirectToAction("Students", new { id = model.GroupId });
        }
Esempio n. 5
0
 public ActionResult DeleteItem(Guid itemId, Guid dataId)
 {
     IRepositories repositories = new RepositoryFactory();
     repositories.ItemRepository.Delete(itemId);
     repositories.Commit();
     return RedirectToAction("Schedule", new { id = dataId });
 }
Esempio n. 6
0
 public ActionResult DeleteGroup(Guid id)
 {
     IRepositories repositories = new RepositoryFactory();
     repositories.GroupRepository.Delete(id);
     repositories.Commit();
     return RedirectToAction("Index");
 }
Esempio n. 7
0
        public ActionResult Students(Guid id)
        {
            IRepositories repositories = new RepositoryFactory();

            var students = new List<Student>();

            (new GroupManager(repositories).GetStudents(id)).ForEach(st => students.Add(new Student(st)));
            repositories.Commit();

            return View(new DataContainer<List<Student>>(students, id));
        }
Esempio n. 8
0
 public ActionResult Index(string groupName)
 {
     IRepositories repositories = new RepositoryFactory();
     DBLE.Group gGroup = new DBLE.Group
         {
             Id = Guid.NewGuid(),
             Name = groupName,
             Students = new List<DBLE.Student>()
         };
     repositories.GroupRepository.Insert(gGroup);
     repositories.Commit();
     return RedirectToAction("Index");
 }
Esempio n. 9
0
        public ActionResult EditStudent(Student model)
        {
            IRepositories repositories = new RepositoryFactory();
            DBLE.Student student = StudentConverter(model);
            student.Id = model.Id;
            repositories.StudentRepository.Update(student);

            repositories.Commit();

            return RedirectToAction("Students", new { id = model.GroupId });
        }
Esempio n. 10
0
 public ActionResult EditItem(Item model)
 {
     IRepositories repositories = new RepositoryFactory();
     DBLE.Item item = ItemConvertor(model);
     item.Id = model.Id;
     repositories.ItemRepository.Update(item);
     repositories.Commit();
     return RedirectToAction("Schedule", new {id = model.DataId});
 }
Esempio n. 11
0
        //studentId
        public ActionResult DeleteStudent(Guid groupId, Guid studentId)
        {
            IRepositories repositories = new RepositoryFactory();
            new GroupManager(repositories).DeleteStudent(studentId);

            repositories.Commit();
            return RedirectToAction("Students", new { id = groupId });
        }
        public ActionResult DeleteTeacher(Guid teacherId)
        {
            IRepositories repositories = new RepositoryFactory();
            new GroupManager(repositories).DeleteStudent(teacherId);

            repositories.Commit();
            return RedirectToAction("Index");
        }