Exemplo n.º 1
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

                });
        }
Exemplo n.º 2
0
 public void AddGroupSchedule(Guid groupId, Schedule schedule, int subGroupNumber)
 {
     switch (subGroupNumber)
     {
         case 1: { r.GroupRepository.GetById(groupId).Schedule1 = schedule; break;}
         case 2: { r.GroupRepository.GetById(groupId).Schedule2 = schedule; break;}
         default:
             {
                 throw new InvalidOperationException("Subgroup number mast be 1 or 2");
             }
     }
 }
Exemplo n.º 3
0
 public void AddTeacherSchedule(Schedule schedule, Guid teacherId)
 {
     r.TeacherRepository.GetById(teacherId).Schedule = schedule;
     r.ScheduleRepository.Insert(schedule);
 }