public IActionResult GetWebsiteDataByPropertyPath([FromRoute] string schemaid, [FromBody] GetWebsiteDataByPropertyPathV2 requestModel, [FromRoute] string clientid = null) { try { var userId = AuthHelper.AuthorizeRequest(Request); if (string.IsNullOrEmpty(userId) && (string.IsNullOrEmpty(clientid) || BasePluginConfigGenerator.GetBasePlugin(clientid).GetClientId() != clientid.Trim().ToUpper())) { return(new CommonActionResult(CommonAPIResponse.UnAuthorized())); } requestModel.SchemaId = schemaid; var validationResult = requestModel.Validate(); if (validationResult.Any()) { return(BadRequest(validationResult)); } var result = new List <GetWebsiteDataByPropertyResponseModel>(); var segmentRequet = new GetWebsiteDataByPropertyPath() { SchemaId = requestModel.SchemaId, UserEmail = requestModel.UserEmail, WebsiteId = requestModel.WebsiteId }; foreach (var segments in requestModel.BulkPropertySegments) { segmentRequet.PropertySegments = segments; result.Add(MongoConnector.GetWebsiteDataByPropertyPath(segmentRequet)); } return(new CommonActionResult(CommonAPIResponse.OK(result))); } catch (Exception ex) { return(BadRequest(ex)); } }
public IActionResult GetWebsiteDataByPropertyPath([FromRoute] string schemaid, [FromBody] GetWebsiteDataByPropertyPath requestModel, [FromRoute] string clientid = null) { try { var userId = AuthHelper.AuthorizeRequest(Request); if (string.IsNullOrEmpty(userId) && (string.IsNullOrEmpty(clientid) || BasePluginConfigGenerator.GetBasePlugin(clientid).GetClientId() != clientid.Trim().ToUpper())) { return(new CommonActionResult(CommonAPIResponse.UnAuthorized())); } requestModel.SchemaId = schemaid; var validationResult = requestModel.Validate(); if (validationResult.Any()) { return(BadRequest(validationResult)); } var result = MongoConnector.GetWebsiteDataByPropertyPath(requestModel); return(new CommonActionResult(CommonAPIResponse.OK(result))); } catch (Exception ex) { return(BadRequest(ex)); } }