private ApplicationViewModel GetApplicationModel(int applicantId, int?applicationId)
        {
            var model = new ApplicationViewModel();

            if (!applicationId.HasValue)
            {
                model.ApplicantId   = applicantId;
                model.ApplicantName = _applicantService.GetApplicant(applicantId).ApplicantName;
            }
            else
            {
                var application = _applicationService.GetApplication(applicationId.Value);

                if (application == null)
                {
                    return(model);
                }

                model.ApplicationId         = application.ApplicantId;
                model.CourseName            = application.CourseName.Trim();
                model.PersonalStatement     = application.PersonalStatement;
                model.TeacherReference      = application.TeacherReference;
                model.TeacherContactDetails = application.TeacherContactDetails.Trim();
                model.UniversityId          = application.UniversityId;
                model.UniversityOffer       = application.UniversityOffer;
                model.Firm           = application.Firm;
                model.ApplicantId    = application.ApplicantId;
                model.ApplicantName  = application.Applicant.ApplicantName.Trim();
                model.OfferCondition = application.OfferCondition;
                model.RejectReason   = application.RejectReason;

                var university = _universityHelper.GetUniversity(model.UniversityId);

                if (university != null)
                {
                    model.UniversityName = university.UniversityName.Trim();
                }
            }

            model = SetApplicationViewModel(model);

            var courses = _universityHelper.GetCourses(model.UniversityId);

            if (courses.Any(x => x.CourseName == model.CourseName))
            {
                var course = courses.First(x => x.CourseName == model.CourseName);

                model.CourseContent     = course.CourseContent.Trim();
                model.CourseDescription = course.CourseDescription.Trim();
                model.EntryCriteria     = course.EntryCriteria.Trim();
            }

            return(model);
        }
Пример #2
0
        // GET: Staff
        public ActionResult Courses(int universityId)
        {
            var universities = _universityService.GetUniversities();

            ViewBag.UniversityName = universities.First(x => x.UniversityId == universityId).UniversityName;

            var courses = _universityHelper.GetCourses(universityId);

            return(View(courses));
        }