public ActionResult Create()
        {
            ViewBag.Title = "Создание расписания";
            ViewBag.IsNew = true;
            var schedule = new Schedule {/*BeginDate = DateTime.Today*/
            };

            //ViewBag.PatientCode_Data = new SelectList(DataProvider.GetList(new PatientDataFilter()), "Id", "FullName");
            ViewBag.TrialCenterID_Data = new SelectList(DataProvider.GetList(new TrialCenterDataFilter()), "Id", "Number");
            ViewBag.ScheduleStatuses   = ScheduleStatus.GetScheduleStatuses();
            return(View(schedule));
        }
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Index", "Schedules"));
            }
            ViewBag.Title = "Управление расписанием";
            ViewBag.IsNew = false;

            var schedule = DataProvider.GetItem(new ScheduleDataFilter {
                ScheduleID = id
            });

            if (schedule == null)
            {
                throw new ApplicationException("Расписание с кодом '" + id + "' не найдено");
            }


            //получаем список пользователей
            var users = DataProvider.GetList(new UserDataFilter());
            //Получаем список пациентов
            //var patients = DataProvider.GetList(new PatientDataFilter());
            //Получаем список исследований
            //var trials = DataProvider.GetList(new TrialDataFilter());
            //Получаем список исследовательских центров
            var trialCenters = DataProvider.GetList(new TrialCenterDataFilter());
            //получаем список ролей
            var systemRoles = DataProvider.GetList(new RoleDataFilter());

            ViewBag.Users = users;
            //ViewBag.PatientCode_Data = new SelectList(patients, "Id", "FullName");
            ViewBag.TrialCenterID_Data = new SelectList(trialCenters, "Id", "Number");
            ViewBag.SystemRoles        = systemRoles;
            ViewBag.ScheduleStatuses   = ScheduleStatus.GetScheduleStatuses();
            //-------------------
            //ViewBag.Procedures = DataProvider.GetList(new ProcedureDataFilter());
            ViewBag.Visits = DataProvider.GetList(new ScheduleVisitDataFilter {
                ScheduleID = id
            });
            //----------------
            return(View(schedule));
        }