Esempio n. 1
0
        public async Task <ActionResult> AddRegistration(string groupId, string semesterId,
                                                         string studentId, string flowSubjectId)
        {
            if (string.IsNullOrEmpty(studentId))
            {
                List <Student> students = await Student.GetCollectionAsync(groupId, semesterId);

                List <Person> people = await Person.GetCollectionAsync();

                ViewBag.students      = students;
                ViewBag.flowSubjectId = flowSubjectId;
                return(View("AddReg"));
            }
            else
            {
                Student.StudentFlowSubject studentFlowSubject = new Student.StudentFlowSubject
                {
                    StudentId     = studentId,
                    FlowSubjectId = flowSubjectId
                };
                if (await studentFlowSubject.Add())
                {
                    return(Redirect(string.Format("/Student/{0}/registry", flowSubjectId)));
                }
                else
                {
                    return(View("~/Views/Shared/Error.cshtml"));
                }
            }
        }
Esempio n. 2
0
 public async Task <ActionResult> Add(Student.StudentFlowSubject registration)
 {
     if (registration != null)
     {
         if (await registration.Add())
         {
             return(View()); //TODO: редирект на страницу списка зареганных студентов
         }
     }
     return(View("~/Views/Shared/Error.cshtml"));
 }