public async Task <IActionResult> Search([FromBody] JObject jObj) { if (jObj == null) { throw new ArgumentNullException(nameof(jObj)); } EndpointTypes type; JToken jType; if (!jObj.TryGetValue(Constants.EndpointNames.Type, out jType)) { return(this.GetError(string.Format(Constants.Errors.ErrParamNotSpecified, Constants.EndpointNames.Type), HttpStatusCode.InternalServerError)); } if (!Enum.TryParse(jType.ToString(), out type)) { return(this.GetError(string.Format(Constants.Errors.ErrParamNotSpecified, Constants.EndpointNames.Type), HttpStatusCode.InternalServerError)); } var parameter = new SearchEndpointsParameter { Type = type }; var result = await _endpointRepository.Search(parameter); return(new OkObjectResult(ToJson(result))); }