Example #1
0
        public async Task <IHttpActionResult> GetBriefProfile()
        {
            var person = SecurityPrincipal.Current;
            var role   = person.Role;

            if (role.Equals("Admin", System.StringComparison.InvariantCultureIgnoreCase))
            {
                return(Ok(await _teachersService.GetBriefStaffProfileAsync(person.PersonUSI)));
            }

            if (role.Equals("Parent", System.StringComparison.InvariantCultureIgnoreCase))
            {
                return(Ok(await _parentsService.GetBriefParentProfileAsync(person.PersonUSI)));
            }

            if (role.Equals("Student", System.StringComparison.InvariantCultureIgnoreCase))
            {
                return(Ok(await _studentsService.GetPersonBriefModelAsync(person.PersonUSI)));
            }

            var result = await _teachersService.GetBriefStaffProfileAsync(person.PersonUSI);

            result.Role = person.Role;

            return(Ok(result));
        }