public IActionResult BMI([FromBody] BMIModel data) { //CONVERT TO DOUBLE var height = Convert.ToDouble(data.Height); var weight = Convert.ToDouble(data.Weight); if (weight.GetType() != typeof(double) || height.GetType() != typeof(double)) { response.Status = "Fail"; response.Description = "Please enter your weight and height as a number"; return(BadRequest(response)); } else { response.Status = "Success"; response.Description = "Calculated BMI"; response.Data = Math.Round(Calculation.BMICalc(weight, height), 2); return(Ok(response)); } }