public async Task RevokeApplicationAsync() { CollaboratorProfileOverview profile = null; if (SelectedFacultyMemberProfileOverview != null) { profile = SelectedFacultyMemberProfileOverview; } else if (SelectedStudentProfileOverview != null) { profile = SelectedStudentProfileOverview; } if (profile != null) { ProjectApplication application = new ProjectApplication { ApplicantId = User.CurrentUserId }; if (selectedFacultyMemberProfileIndex != -1) { application.CollaboratorProfileId = SelectedProject.CollaboratorProfiles.Where(p => p is FacultyMemberProfile).ElementAt(selectedFacultyMemberProfileIndex).CollaboratorProfileId; } else if (selectedStudentProfileIndex != -1) { application.CollaboratorProfileId = SelectedProject.CollaboratorProfiles.Where(p => p is StudentProfile).ElementAt(selectedStudentProfileIndex).CollaboratorProfileId; } await((App)App.Current).applications.RemoveAsync(application); } }
public async void ApplyForPosition() { CollaboratorProfileOverview profile = null; if (SelectedFacultyMemberProfileOverview != null) { profile = SelectedFacultyMemberProfileOverview; } else if (SelectedStudentProfileOverview != null) { profile = SelectedStudentProfileOverview; } if (profile != null) { ProjectApplication application = new ProjectApplication { ApplicantId = User.CurrentUserId, ApplicantComment = "" }; // searching for selected collaborator profile if (selectedFacultyMemberProfileIndex != -1) { application.CollaboratorProfileId = SelectedProject.CollaboratorProfiles.Where(p => p is FacultyMemberProfile).ElementAt(selectedFacultyMemberProfileIndex).CollaboratorProfileId; } else if (selectedStudentProfileIndex != -1) { application.CollaboratorProfileId = SelectedProject.CollaboratorProfiles.Where(p => p is StudentProfile).ElementAt(selectedStudentProfileIndex).CollaboratorProfileId; } Project project = await((App)App.Current).projects.GetByCollaboratorProfileAsync(application.CollaboratorProfileId); if (project.ProjectStatus != ProjectStatus.Closed) { await((App)App.Current).applications.AddAsync(application); } } }