コード例 #1
0
 public IHttpActionResult GetProfile([FromUri(Name = "impersonateDonorId")] int?impersonateDonorId = null)
 {
     return(Authorized(token =>
     {
         var impersonateUserId = impersonateDonorId == null ? string.Empty : _donorService.GetContactDonorForDonorId(impersonateDonorId.Value).Email;
         try
         {
             var person = (impersonateDonorId != null)
                 ? _impersonationService.WithImpersonation(token, impersonateUserId, () => _personService.GetLoggedInUserProfile(token))
                 : _personService.GetLoggedInUserProfile(token);
             if (person == null)
             {
                 return Unauthorized();
             }
             return Ok(person);
         }
         catch (UserImpersonationException e)
         {
             return (e.GetRestHttpActionResult());
         }
     }));
 }