コード例 #1
0
        public async Task <IActionResult> Add([FromRoute] Guid tenantId, [FromBody] CreateRuleDto createRuleDto)
        {
            RuleResultDto createRuleResultDto = await this.ruleService.Add(tenantId, createRuleDto);

            if (createRuleResultDto.AffectedRule != null)
            {
                return(this.Ok(createRuleResultDto.AffectedRule));
            }

            return(this.BadRequest(createRuleResultDto.ErrorMessages));
        }
コード例 #2
0
        public async Task <IActionResult> Update([FromRoute] Guid tenantId, [FromRoute] Guid id, [FromBody] UpdateRuleDto updateRuleDto)
        {
            try
            {
                RuleResultDto ruleResultDto = await this.ruleService.Update(tenantId, id, updateRuleDto);

                if (ruleResultDto.AffectedRule != null)
                {
                    return(this.Ok(ruleResultDto.AffectedRule));
                }

                return(this.BadRequest(ruleResultDto.ErrorMessages));
            }
            catch (NotFoundException)
            {
                return(this.NotFound("A rule w/ the given tenant id and id was not found"));
            }
        }