public async Task <HttpResponseMessage> Find([FromBody] string[] uniqueIds) { try { if ((_identitySubsystemAsync.IdentityServiceCapabilities & IdentityServiceCapabilities.Find) != 0) { var result = await _identitySubsystemAsync.Find(uniqueIds); switch (result.StatusCode) { case IdentityStatusCode.Success: var response = Request.CreateResponse(HttpStatusCode.Accepted); var route = Url.Link( "IdentitiesSearchResult", new { id = result.Data }); response.Headers.Location = new Uri(route); return(response); case IdentityStatusCode.Incomplete: return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, InvalidServerResponse + "Incomplete")); case IdentityStatusCode.InvalidProperties: return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, InvalidServerResponse + "Invalid Properties")); case IdentityStatusCode.NotFound: return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, InvalidServerResponse + "Not Found")); default: return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, InvalidServerResponse + "Unknown")); } } if ((_identitySubsystem.IdentityServiceCapabilities & IdentityServiceCapabilities.Find) != 0) { var result = await _identitySubsystem.Find(uniqueIds); if (result.StatusCode == IdentityStatusCode.Success) { return(Request.CreateResponse(HttpStatusCode.OK, result.Data)); } } return(NotImplemented()); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadGateway, ex)); } }
public async Task <IActionResult> Find([FromBody] string[] uniqueIds) { try { if ((_identitySubsystemAsync.IdentityServiceCapabilities & IdentityServiceCapabilities.Find) != 0) { var result = await _identitySubsystemAsync.Find(uniqueIds); switch (result.StatusCode) { case IdentityStatusCode.Success: var route = Url.Link("IdentitiesSearchResult", new { id = result.Data }); return(Accepted(route)); case IdentityStatusCode.Incomplete: return(StatusCode((int)HttpStatusCode.BadGateway, InvalidServerResponse + "Incomplete")); case IdentityStatusCode.InvalidProperties: return(StatusCode((int)HttpStatusCode.BadGateway, InvalidServerResponse + "Invalid Properties")); case IdentityStatusCode.NotFound: return(NotFound(InvalidServerResponse + "Not Found")); default: return(StatusCode((int)HttpStatusCode.BadGateway, InvalidServerResponse + "Unknown")); } } if ((_identitySubsystem.IdentityServiceCapabilities & IdentityServiceCapabilities.Find) != 0) { var result = await _identitySubsystem.Find(uniqueIds); if (result.StatusCode == IdentityStatusCode.Success) { return(Ok(result.Data)); } } return(NotImplemented()); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.BadGateway, ex)); } }