public EditPeopleViewData(IEnumerable <Person> allPeople, IEnumerable <ProjectPersonRelationshipType> allRelationshipTypes, Person currentPerson) { AllPeople = allPeople.OrderBy(x => x.LastName).Select(x => new PersonSimple(x)).ToList(); AllProjectPersonRelationshipTypes = allRelationshipTypes.Except(new List <ProjectPersonRelationshipType> { ProjectPersonRelationshipType.PrimaryContact }).Select(x => new ProjectPersonRelationshipTypeSimple(x)).ToList(); PrimaryContactProjectPersonRelationshipType = new ProjectPersonRelationshipTypeSimple(ProjectPersonRelationshipType.PrimaryContact); UserCanManageContacts = new ContactManageFeature().HasPermissionByPerson(currentPerson); AddContactUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Index()); }
public EditInteractionEventViewData(Person currentPerson, EditInteractionEventEditType editInteractionEventEditType, IEnumerable <Models.InteractionEventType> interactionEventTypes, IEnumerable <Models.Person> allPeople, int interactionEventID, IEnumerable <Models.Project> allProjects) { InteractionEventTypes = interactionEventTypes.ToSelectListWithEmptyFirstRow(x => x.InteractionEventTypeID.ToString(CultureInfo.InvariantCulture), y => y.InteractionEventTypeDisplayName);//sorted in the controller // Sorted and filtered on controller StaffPeople = allPeople.Where(p => p.Organization != null && p.Organization.OrganizationName == Models.Organization.OrganizationWADNR).ToSelectListWithEmptyFirstRow(x => x.PersonID.ToString(CultureInfo.InvariantCulture), y => y.FullNameFirstLast); EditInteractionEventEditType = editInteractionEventEditType; var allProjectSimples = allProjects.OrderBy(x => x.DisplayName).Select(x => new ProjectSimple(x)).ToList(); UserCanManageContacts = new ContactManageFeature().HasPermissionByPerson(currentPerson); AddContactUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Index()); var allContactSimples = allPeople.Select(x => new PersonSimple(x)).ToList(); AngularViewData = new EditInteractionEventAngularViewData(interactionEventID, allContactSimples, allProjectSimples); PostUrl = GetPostUrl(interactionEventID); }