コード例 #1
0
        public Tuple <bool, string> JsonValidator(JsonInputDto input)
        {
            ValidatorService s = new ValidatorService();
            var output         = s.JsonValidator(input.JsonData);

            return(Tuple.Create(output.Item1, output.Item2));
        }
コード例 #2
0
        public IActionResult UploadJSON([FromRoute] string orgRoleId, [FromBody] JsonInputDto input)
        {
            if (string.IsNullOrWhiteSpace(orgRoleId) || string.IsNullOrEmpty(orgRoleId))
            {
                return(StatusCode(StatusCodes.Status400BadRequest,
                                  new BadRequestError($"'{nameof(orgRoleId)}' cannot be null or whitespace")));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid Model"));
            }

            OrganizationRole organizationRole = _organizationRoleService.Get <OrganizationRole>(
                orgRole => orgRole.Id == orgRoleId,
                asNoTracking: true,
                orgRole => orgRole.Organization);

            if (organizationRole == null)
            {
                return(StatusCode(StatusCodes.Status404NotFound, new NotFoundError($"organizationRole not found")));
            }


            try
            {
                _dataUploaderService.Insert(input.PerfPartcipationDetails);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  new InternalServerError(ex.Message)));
            }
        }