private void MapParentInformation(Data.Entities.Student source, ProfileModel target) { var studentParentAssociations = source.StudentParentAssociations; var parent1 = studentParentAssociations.First().Parent; target.EditProfileParentModel = _parentToProfileParentModelMapper.Build(parent1); if (studentParentAssociations.Count == 2) { var parent2 = studentParentAssociations.ElementAt(1).Parent; target.SecondEditProfileParentModel = _parentToProfileParentModelMapper.Build(parent2); } }
// // GET: /Assessment/EnterResults/1/ public virtual ActionResult EnterResults(int id) { var assessment = _assessmentRepository.GetAssessmentByAssessmentId(id); if (assessment == null) { return(View("Error")); } var enterResultsModel = _assessmentToEnterResultsModelMapper.Build(assessment); return(View(enterResultsModel)); }
public virtual ActionResult EnterProgramStatus(EnterProgramStatusModel enterProgramStatusModel, int id) { if (!ModelState.IsValid) { return(View(enterProgramStatusModel)); } var specialEducationFileName = _fileUploader.Upload(enterProgramStatusModel.SpecialEducationFile, id, "ProgramStatus", "specialEducation"); var testingAccomodationFileName = _fileUploader.Upload(enterProgramStatusModel.TestingAccommodationFile, id, "ProgramStatus", "testingAccomodation"); var titleParticipationFileName = _fileUploader.Upload(enterProgramStatusModel.TitleParticipationFile, id, "ProgramStatus", "titleParticipation"); var mcKinneyVentoFileName = _fileUploader.Upload(enterProgramStatusModel.McKinneyVentoFile, id, "ProgramStatus", "mcKinneyVento"); var studentProgramStatus = _programStatusMapper.Build(enterProgramStatusModel, psm => { psm.StudentUSI = id; psm.TitleParticipationFile = titleParticipationFileName; psm.TestingAccommodationFile = testingAccomodationFileName; psm.SpecialEducationFile = specialEducationFileName; psm.McKinneyVentoFile = mcKinneyVentoFileName; }); _repository.Add(studentProgramStatus); _repository.Save(); return(RedirectToAction(MVC.Student.Index(id))); }
private List <ClassPeriodListItemModel> GetClassPeriodNameModels() { var classPeriods = _genericRepository.GetAll <ClassPeriod>().ToList(); return(classPeriods.Select(classPeriod => _classPeriodToClassPeriodNameModelMapper.Build(classPeriod)).ToList()); }
public virtual ActionResult ForSession(int id) { var session = _sessionRepository.GetWithSectionsById(id); var sessionWithSectionsModel = _sessionToSessionWithSectionsModelMapper.Build(session); return(View(sessionWithSectionsModel)); }
private void MapStudentAddress(Data.Entities.Student source, ProfileModel target) { var studentAddresses = source.StudentAddresses; var studentAddress = studentAddresses.First(address => address.AddressTypeId == (int)AddressTypeEnum.Home); target.HomeAddress = _studentAddressToHomeAddressModelMapper.Build(studentAddress); }
public virtual ActionResult AddUser(AddUserModel model) { if (!ModelState.IsValid) { return(View(model)); } var staff = _addUserModelToStaffMapper.Build(model); _genericRepository.Add(staff); _genericRepository.Save(); var user = _addUserModelToApplicationUserMapper.Build(model); var result = _userManager.Create(user, model.Password); if (result.Succeeded) { _userManager.AddToRole(user.Id, model.Role.Humanize()); return(RedirectToAction("Users")); } AddErrors(result); return(View(model)); }
public virtual ActionResult Edit(Guid id) { var parentCourse = _parentCourseRepository.GetById(id); var editModel = _parentCourseToEditModelMapper.Build(parentCourse); return(View(editModel)); }
public virtual JsonResult ScheduleStudent(SetModel setModel) { if (!ModelState.IsValid) { var errors = ModelState.Values.SelectMany(v => v.Errors).ToList(); return(Json(new { errors }, JsonRequestBehavior.AllowGet)); } var studentSectionAssociation = _setModelToStudentSectionAssociationMapper.Build(setModel); _genericRepository.Add(studentSectionAssociation); _genericRepository.Save(); var sectionListItem = _studentSectionAssociationToSectionListItemModelMapper.Build(studentSectionAssociation); return(Json(sectionListItem, JsonRequestBehavior.AllowGet)); }
public virtual ActionResult Index() { var parentCourses = _parentCourseRepository.GetParentCourses(); var indexModels = parentCourses.Select(pc => _parentCourseToIndexModelMapper.Build(pc)); return(View(indexModels)); }
public virtual ActionResult Users() { var users = _staffRepository.GetStaffWithUsers(); var userModels = users.Select(source => _staffToUserModelMapper.Build(source)).ToList(); return(View(userModels)); }
public override void Map(Data.Entities.Assessment source, EnterResultsModel target) { var assessmentSections = source.AssessmentSections; var section = assessmentSections.First().Section; var session = section.Session; var administeredDate = source.AdministeredDate; var studentSectionAssociations = section.StudentSectionAssociations .Where(ssa => new DateRange(ssa.BeginDate, ssa.EndDate.GetValueOrDefault()).Includes(administeredDate)); var students = studentSectionAssociations.Select(ssa => ssa.Student).ToList(); target.AssessmentId = source.AssessmentIdentity; target.Section = section.UniqueSectionCode; target.AssessmentTitle = source.AssessmentTitle; target.Session = session.SessionName; target.CCSS = source.AssessmentLearningStandards.First().LearningStandard.Description; target.AssessmentDate = source.AdministeredDate.ToShortDateString(); target.StudentResults = new List <EnterResultsStudentModel>(); if (source.StudentAssessments.IsNullOrEmpty()) { // create new target.StudentResults = students.Select(s => new EnterResultsStudentModel { StudentUsi = s.StudentUSI, Name = s.FirstName + " " + s.LastSurname, ProfileThumbnailUrl = _profilePhotoUrlFetcher.GetProfilePhotoThumbnailUrlOrDefault(s.StudentUSI) }).ToList(); } else { target.StudentResults = source.StudentAssessments.Select(sa => _studentAssessmentToEnterResultsStudentModelMapper.Build(sa)) .ToList(); } }
// // GET: /Assessment/ public virtual ActionResult Index() { var assessments = _assessmentRepository.GetAssessments(); var assessmentIndexModels = assessments.Select(a => _assessmentToAssessmentIndexModelMapper.Build(a)); return(View(assessmentIndexModels)); }
public virtual ActionResult Set(int id) { var student = _genericRepository.Get <Student>(s => s.StudentUSI == id); var profilePhotoUrl = _profilePhotoUrlFetcher.GetProfilePhotoUrlOrDefault(student); var sessionModels = GetAllSessionModels(); var defaultSessionListModel = new SessionListItemModel(); if (!sessionModels.IsNullOrEmpty()) { defaultSessionListModel = _sessionToSessionListItemModelMapper.Build(new SessionFilter(_genericRepository).FindSession(DateTime.Now)); } var currentlyEnrolledSections = GetCurrentlyEnrolledSectionsFor(id); var setModel = SetModel.CreateNewWith(student, profilePhotoUrl, sessionModels, defaultSessionListModel, currentlyEnrolledSections); return(View(setModel)); }
public virtual JsonResult GetCourses(string searchString) { var courses = _genericRepository.GetAll <Course>() .Where(c => ContainsCourseTitle(searchString, c) || ContainsCourseCode(searchString, c)).ToList(); var courseModels = courses.Select(c => _courseToCourseJsonModelMapper.Build(c)); return(Json(courseModels, JsonRequestBehavior.AllowGet)); }
public override void Map(CreateParentModel source, StudentParentAssociation target) { target.RelationTypeId = (int)source.RelationshipToStudent.GetValueOrDefault(); target.PrimaryContactStatus = source.MakeThisPrimaryContact; target.LivesWith = source.SameAddressAsStudent; target.Parent = _parentMapper.Build(source); if (ParentHasDifferentAddressThanStudent(source)) { target.Parent.ParentAddresses.Add(_parentAddressMapper.Build(source)); } }
public void ShouldMapSessionToSessionListItemModel() { var session = new SessionBuilder().Build(); _mapper = new SessionToSessionListItemModelMapper(); var sessionListItemModel = _mapper.Build(session); sessionListItemModel.BeginDate.ShouldBe(session.BeginDate); sessionListItemModel.EndDate.ShouldBe(session.EndDate); sessionListItemModel.SessionId.ShouldBe(session.SessionIdentity); sessionListItemModel.SessionName.ShouldBe(session.SessionName); }
public virtual ActionResult Create(CreateModel createModel) { if (!ModelState.IsValid) { createModel.CommonCoreStandards = _learningStandardRepository.GetAllCommonCoreAnchorStandards(); return(View(createModel)); } var assessment = _createModelToAssessmentMapper.Build(createModel); _assessmentRepository.Save(assessment); return(RedirectToAction(MVC.Assessment.Index())); }
public virtual ActionResult Index(int usi) { var student = _studentRepository.GetByUSI(usi); if (student == null) { return(HttpNotFound()); } var profileModel = _studentToProfileModelMapper.Build(student); return(View(profileModel)); }
public virtual ActionResult Create(CreateModel createModel) { if (!ModelState.IsValid) { return(View(createModel)); } var parentCourse = _createModelToParentCourseMapper.Build(createModel); _genericRepository.Add(parentCourse); _genericRepository.Save(); return(RedirectToAction(Actions.Index())); }
public override void Map(CreateStudentModel source, Data.Entities.Student target) { SetStudentNativeProperties(source, target); var studentAddress = _studentAddressMapper.Build(source); target.StudentAddresses.Add(studentAddress); var studentLanguage = _studentLanguageMapper.Build(source); target.StudentLanguages = new List <StudentLanguage> { studentLanguage }; var firstParentAssociation = _studentParentAssociationMapper.Build(source.FirstParent); target.StudentParentAssociations.Add(firstParentAssociation); if (source.AddSecondParent) { var secondParentAssociation = _studentParentAssociationMapper.Build(source.SecondParent); target.StudentParentAssociations.Add(secondParentAssociation); } }
public virtual JsonResult GetParentCourses(string searchString) { var parentCourses = _genericRepository.GetAll <ParentCourse>().Where(pc => pc.ParentCourseTitle.ToLower().Contains(searchString.ToLower()) || pc.ParentCourseCode.ToLower().Contains(searchString.ToLower())).ToList(); var parentCourseJsonModels = parentCourses.Select(p => _parentCourseToParentCourseJsonModelMapper.Build(p)).ToList(); if (parentCourseJsonModels.IsNullOrEmpty()) { parentCourseJsonModels.Add(new ParentCourseJsonModel { LabelName = "No results" }); } return(Json(parentCourseJsonModels, JsonRequestBehavior.AllowGet)); }
public void ShouldMapSetModelToStudentSectionAssociation() { SetUp(); var setModel = new SetScheduleModelBuilder().Build(); var studentSectionAssociation = _mapper.Build(setModel); studentSectionAssociation.BeginDate.ShouldBe(setModel.BeginDate); studentSectionAssociation.EndDate.ShouldBe(setModel.EndDate); studentSectionAssociation.StudentUSI.ShouldBe(setModel.StudentUsi); studentSectionAssociation.SchoolYear.ShouldBe(_section.SchoolYear); studentSectionAssociation.TermTypeId.ShouldBe(_section.TermTypeId); studentSectionAssociation.LocalCourseCode.ShouldBe(_section.LocalCourseCode); studentSectionAssociation.ClassPeriodName.ShouldBe(_section.ClassPeriodName); studentSectionAssociation.ClassroomIdentificationCode.ShouldBe(_section.ClassroomIdentificationCode); studentSectionAssociation.SchoolId.ShouldBe(_school.SchoolId); }
public virtual JsonResult GetSessions(string searchString) { var sessions = _genericRepository.GetAll <Session>() .Where(s => s.SessionName.ToLower().Contains(searchString.ToLower())).ToList(); var sessionModels = sessions.Select(s => _sessionToSessionJsonModelMapper.Build(s)).ToList(); if (sessionModels.IsNullOrEmpty()) { sessionModels.Add(new SessionJsonModel { SessionName = "No results" }); } return(Json(sessionModels, JsonRequestBehavior.AllowGet)); }
private IEnumerable <AutocompleteModel> GetAllSectionAutocompleteModelsWith(string searchString, int sessionId) { var session = _genericRepository.Get <Session>(s => s.SessionIdentity == sessionId); var query = new SectionsBySectionNameAndSessionQuery(searchString, session); var sections = _genericRepository.GetAll(query).ToList(); var autocompleteModels = sections.Select(section => _sectionToAutocompleteModelMapper.Build(section)).ToList(); if (autocompleteModels.IsNullOrEmpty()) { autocompleteModels.Add(new AutocompleteModel { LabelName = "No results" }); } return(autocompleteModels); }
private void CreateSection(CreateModel createModel) { var section = _createModelToSectionMapper.Build(createModel); var session = _genericRepository.Get <Session>(s => s.SessionIdentity == createModel.SessionId); var courseOfferingByPrimaryKeysQuery = new CourseOfferingByPrimaryKeysQuery(createModel.Course, session.SchoolYear, session.TermTypeId); if (CourseOfferingNeedsToBeCreated(courseOfferingByPrimaryKeysQuery)) { var courseOffering = _createModelToCourseOfferingMapper.Build(createModel); _genericRepository.Add(courseOffering); } _genericRepository.Add(section); _genericRepository.Save(); }
public ParentCourseGradesModel Build(List <Data.Entities.Student> students, Data.Entities.Session session, Data.Entities.ParentCourse parentCourse) { var findParentCourseModel = _sectionToFindParentCourseModelMapper.Build(session, t => { t.ParentCourse = parentCourse.ParentCourseCode + " - " + parentCourse.ParentCourseTitle; t.ParentCourseId = parentCourse.Id; }); var grades = students.SelectMany(s => s.ParentCourseGrades); var parentGradesModelList = grades.Select(g => _parentCourseGradeToGradeModelMapper.Build(g)).ToList(); var studentsInParentCourseWithoutGrades = students.Where(s => s.ParentCourseGrades.IsNullOrEmpty()).ToList(); parentGradesModelList = parentGradesModelList.Concat(studentsInParentCourseWithoutGrades.Select(s => _studentToGradeModelMapper.Build(s))).ToList(); var parentCourseGradesModel = new ParentCourseGradesModel(); parentCourseGradesModel.FindParentCourseModel = findParentCourseModel; parentCourseGradesModel.ParentGradesModelList = parentGradesModelList.ToList(); return(parentCourseGradesModel); }
public virtual ActionResult EnterAcademicDetails(AcademicDetailModel academicDetailModel, int id) { if (!ModelState.IsValid) { return(View(academicDetailModel)); } var fileCategory = ((int)academicDetailModel.SchoolYear).ToString(CultureInfo.InvariantCulture); var performanceHistoryFileName = _fileUploader.Upload(academicDetailModel.PerformanceHistoryFile, id, fileCategory, "performanceHistory"); var studentAcademicDetail = _academicDetailMapper.Build(academicDetailModel, adm => { adm.StudentUSI = id; adm.PerformanceHistoryFile = performanceHistoryFileName; }); var studentSchoolAssociation = _schoolAssociationMapper.Build(academicDetailModel); _repository.Add(studentAcademicDetail); _repository.Add(studentSchoolAssociation); _repository.Save(); return(RedirectToAction(MVC.Enrollment.EnterProgramStatus(id))); }
private List <LocationListItemModel> GetClassRoomModels() { var locations = _genericRepository.GetAll <Location>().ToList(); return(locations.Select(location => _locationToClassRoomModelMapper.Build(location)).ToList()); }
private void MapBasicStudentInfo(Data.Entities.Student source, ProfileModel target) { target.StudentUsi = source.StudentUSI; target.StudentName = _studentNameMapper.Build(source); target.BiographicalInfo = _biographicalInfoMapper.Build(source); }