Ejemplo n.º 1
0
        public EditLabScheduleModelBase CreateEmptyModel(EditLabScheduleModelBase.Kind kind)
        {
            EditLabScheduleModelBase model;

            switch (kind)
            {
            case EditLabScheduleModelBase.Kind.Individual:
                model = new EditIndividualLabScheduleModel
                {
                    Doers = _query.OfEntities <Student>()
                            .Where(s => !s.IsDismissed && s.IsVerified)
                            .ToArray()
                            .ToDictionary(s => s.Id, s => $"[{s.Group.Name}] {s.GetShortName()}")
                };
                break;

            case EditLabScheduleModelBase.Kind.Group:
                model = new EditGroupLabScheduleModel
                {
                    Doers = _query.OfEntities <Group>()
                            .ToArray()
                            .ToDictionary(g => g.Id, g => g.Name)
                };
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(kind));
            }

            model.LabWorks = _query.OfEntities <LabWork>()
                             .OrderBy(lr => lr.Name)
                             .ToArray()
                             .ToDictionary(lr => lr.Id, lr => lr.Name);

            model.DateFrom = _systemDate.Now();
            model.DateTill = _systemDate.Now();

            return(model);
        }
Ejemplo n.º 2
0
 public ActionResult CreateSchedule(EditLabScheduleModelBase.Kind kind)
 {
     return(View(_editModelLoader.CreateEmptyModel(kind)));
 }