Beispiel #1
0
        /// <summary>
        /// Square root one operand and retrieve the result
        /// </summary>
        /// <param name="id">Id Tracking</param>
        /// <returns></returns>
        public static string Sqrt(string id)
        {
            CalcSqrt      par     = new CalcSqrt();
            List <double> numbers = GetNumbers("sqrt", 1);

            if (numbers.Count == 1)
            {
                par.Number = (int)numbers[0];
                return(CallRestApi <CalcSqrt>(par, "sqrt", id));
            }
            else
            {
                return(BadCalculate());
            }
        }
Beispiel #2
0
        public IActionResult sqrt([FromBody] CalcSqrt par)
        {
            var    headers = Request.Headers;
            string track   = headers.Where(x => x.Key == "X-Evi-Tracking-Id").FirstOrDefault().Value;

            double total = Math.Sqrt(par.Number);
            string msg   = "(Square root :" + par.Number + " = " + total.ToString() + ")";

            if (!string.IsNullOrEmpty(track))
            {
                _trk.Operations.Add(new Operations {
                    Id = track, Operation = "Div", Calculation = msg, Date = DateTime.Now
                });
            }

            return(Ok(new { Square = total }));
        }