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); }
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); }