Exemplo n.º 1
0
        public ActionResult Calculate([FromForm] CalculatorConfig config)
        {
            try
            {
                string message = config.IsValid();

                if (!string.IsNullOrEmpty(message))
                {
                    return(StatusCode(417, message));
                }

                Result result = config.ApplyRules();

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(StatusCode(404, "Houve uma falha no sistema"));
            }
        }
Exemplo n.º 2
0
 public Calculator(CalculatorConfig config)
 {
     _config = config;
 }