示例#1
0
        public IActionResult Area([FromBody] AreaModel data)
        {
            //CONVERT TO DOUBLE
            var length = Convert.ToDouble(data.Length);
            var breath = Convert.ToDouble(data.Breath);

            if (length.GetType() != typeof(double) || breath.GetType() != typeof(double))
            {
                response.Status      = "Fail";
                response.Description = "Please input a number";

                return(BadRequest(response));
            }
            else
            {
                response.Status      = "Success";
                response.Description = "Calculated Area";
                response.Data        = Math.Round(Calculation.AreaCalc(length, breath), 2);
                return(Ok(response));
            }
        }