public async Task <IHttpActionResult> GetProfile() { var person = SecurityPrincipal.Current; var role = person.Role; // TODO: If this application grows into something bigger it is important to // refactor this into a more extensible pattern like a chain of responsibility. if (role.Equals("Parent", System.StringComparison.InvariantCultureIgnoreCase)) { return(Ok(await _parentsService.GetParentProfileAsync(person.PersonUSI))); } if (role.Equals("Student", System.StringComparison.InvariantCultureIgnoreCase)) { return(Ok(await _studentsService.GetStudentProfileAsync(person.PersonUSI))); } return(Ok(await _teachersService.GetStaffProfileAsync(person.PersonUSI))); }