Esempio n. 1
0
        public ActionResult AddSubjectForGroup(SubjectEditPageViewModel viewModel, ulong groupID)
        {
            var subjects = viewModel.SubjectViewModels.Select(SubjectMapper.ToModelExpression.Compile());
            this._subjectManager.AddSubjectForGroup(subjects, groupID);

            return this.Json(new {success = true});
        }
Esempio n. 2
0
        public ActionResult SubjectEditPage(ulong groupID)
        {
            if (Request.IsAjaxRequest())
            {
                var viewModel = new SubjectEditPageViewModel();
                viewModel.InstituteSubjectsList = this._subjectManager
                                                      .GetByGroup(groupID)
                                                      .Select(x => new SelectListItem()
                                                          {
                                                              Value = x.Id.ToString(),
                                                              Text = x.Name
                                                          });

                viewModel.SubjectViewModels =
                    this._subjectManager.GetByGroup(groupID)
                        .Select(SubjectMapper.ToViewModelExpression.Compile())
                        .ToList();

                return this.PartialView("Partial/EditSubjectOfGroup", viewModel);
            }

            return this.RedirectToAction("Index", "Home");
        }