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 static SetModel CreateNewWith(Data.Entities.Student student, string profilePhotoUrl, List<SessionListItemModel> sessions, SessionListItemModel session, List<Section.SectionListItemModel> currentlyEnrolledSections) { var setModel = new SetModel { StudentName = String.Join(" ", student.FirstName, student.LastSurname), StudentUsi = student.StudentUSI, ProfilePhotoUrl = profilePhotoUrl, Sessions = sessions, Session = session.SessionId, BeginDate = session.BeginDate, EndDate = session.EndDate, CurrentlyEnrolledSections = currentlyEnrolledSections }; return setModel; }
public static SetModel CreateNewWith(Data.Entities.Student student, string profilePhotoUrl, List <SessionListItemModel> sessions, SessionListItemModel session, List <Section.SectionListItemModel> currentlyEnrolledSections) { var setModel = new SetModel { StudentName = String.Join(" ", student.FirstName, student.LastSurname), StudentUsi = student.StudentUSI, ProfilePhotoUrl = profilePhotoUrl, Sessions = sessions, Session = session.SessionId, BeginDate = session.BeginDate, EndDate = session.EndDate, CurrentlyEnrolledSections = currentlyEnrolledSections }; return(setModel); }