Esempio n. 1
0
 public IActionResult SquareRoot(string number)
 {
     if (number.IsNumeric())
     {
         var squareRoot = Math.Sqrt((double)Convertions.ConvertToDecimal(number));
         return(Ok(squareRoot.ToString()));
     }
     return(BadRequest("Invalid input"));
 }
Esempio n. 2
0
 public IActionResult Division(string firstNumber, string secondNumber)
 {
     if (firstNumber.IsNumeric() && secondNumber.IsNumeric())
     {
         decimal division = Convertions.ConvertToDecimal(firstNumber) / Convertions.ConvertToDecimal(secondNumber);
         return(Ok(division.ToString()));
     }
     return(BadRequest("Invalid input"));
 }
Esempio n. 3
0
 public IActionResult Mean(string firstNumber, string secondNumber)
 {
     if (firstNumber.IsNumeric() && secondNumber.IsNumeric())
     {
         decimal mean = (Convertions.ConvertToDecimal(firstNumber) + Convertions.ConvertToDecimal(secondNumber)) / 2;
         return(Ok(mean.ToString()));
     }
     return(BadRequest("Invalid input"));
 }
Esempio n. 4
0
 public IActionResult Sum(string firstNumber, string secondNumber)
 {
     if (firstNumber.IsNumeric() && secondNumber.IsNumeric())
     {
         decimal sum = Convertions.ConvertToDecimal(firstNumber) + Convertions.ConvertToDecimal(secondNumber);
         return(Ok(sum.ToString()));
     }
     return(BadRequest("Invalid input"));
 }