示例#1
0
        public ActionResult <StringCalculatorDTOV2> PostStringCalculatorv2(StringCalculatorRequestV2 modelo)
        {
            SaveAction            action = new SaveAction(new StringCalculator());
            StringCalculatorDTO   first  = action.ExecuteAPI(modelo.firstSummand);
            StringCalculatorDTO   second = action.ExecuteAPI(modelo.secondSummand);
            StringCalculatorDTOV2 result = new StringCalculatorDTOV2()
            {
                FirstResult = first, SecondResult = second
            };

            if (first == null || second == null)
            {
                return(BadRequest(new BadRequestJSONegativesNotAllowed()));
            }
            return(result);
        }
示例#2
0
        public ActionResult <StringCalculatorDTO> PostStringCalculator(StringCalculatorRequest modelo)
        {
            SaveAction          action    = new SaveAction(new StringCalculator());
            StringCalculatorDTO resultado = action.ExecuteAPI(modelo.Numbers);

            if (resultado == null)
            {
                return(BadRequest(new BadRequestJSONegativesNotAllowed()));
            }
            return(resultado);
        }