public IActionResult DoUntil([FromBody] DTO2 dto)
        {
            int result2 = 0;

            if (dto == null || dto.until == null)
            {
                return(Json(new { error = "Please provide a number!" }));
            }

            if (RouteData.Values["what"].ToString() == "sum")
            {
                for (int i = (int)dto.until; i > 0; i--)
                {
                    result2 += i;
                }
            }
            else if (RouteData.Values["what"].ToString() == "factor")
            {
                result2 = 1;
                for (int i = (int)dto.until; i > 0; i--)
                {
                    result2 *= i;
                }
            }

            return(Json(new { result = result2 }));
        }
        /// <summary>
        /// Converts a value to its XML string representation.
        /// </summary>
        /// <param name="Value">Value</param>
        /// <returns>XML string representation.</returns>
        public string ValueToXmlString(object Value)
        {
            switch (this.dataType)
            {
            case "ui1":
            case "ui2":
            case "ui4":
            case "i1":
            case "i2":
            case "i4":
            case "int":
            case "char":
            case "string":
            case "uri":
            case "uuid":
            default:
                return(Value.ToString());

            case "r4":
            case "r8":
            case "number":
            case "float":
                if (!(Value is double d))
                {
                    if (Value is float f)
                    {
                        d = f;
                    }
                    else if (Value is decimal d2)
                    {
                        d = (double)d2;
                    }
                    else
                    {
                        d = Convert.ToDouble(Value);
                    }
                }

                return(d.ToString().Replace(System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator, "."));

            case "fixed.14.4":

                if (Value is double d3)
                {
                    d = d3;
                }
                else if (Value is float f2)
                {
                    d = f2;
                }
                else if (Value is decimal d4)
                {
                    d = (double)d4;
                }
                else
                {
                    d = Convert.ToDouble(Value);
                }

                return(d.ToString("F4").Replace(System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator, "."));

            case "date":
                if (!(Value is DateTime DT))
                {
                    DT = Convert.ToDateTime(Value);
                }

                return(DT.ToString("yyyyMMdd"));

            case "dateTime":
                if (!(Value is DateTime DT2))
                {
                    DT2 = Convert.ToDateTime(Value);
                }

                return(DT2.ToString("yyyyMMddTHHmmss"));

            case "dateTime.tz":
                if (Value is DateTimeOffset DTO)
                {
                    string   s    = DTO.ToString("yyyyMMddTHHmmss");
                    TimeSpan Zone = DTO.Offset;

                    if (Zone < TimeSpan.Zero)
                    {
                        s   += "-";
                        Zone = -Zone;
                    }
                    else
                    {
                        s += "+";
                    }

                    return(s + Zone.Hours.ToString("D2") + ":" + Zone.Minutes.ToString("D2"));
                }
                else
                {
                    if (!(Value is DateTime DT3))
                    {
                        DT3 = Convert.ToDateTime(Value);
                    }

                    return(DT3.ToString("yyyyMMddTHHmmss"));
                }

            case "time":
                if (Value is TimeSpan TS)
                {
                    return(TS.Hours.ToString("D2") + ":" + TS.Minutes.ToString("D2") + ":" + TS.Seconds.ToString("D2"));
                }
                else if (Value is DateTime DT4)
                {
                    return(DT4.ToString("HH:mm:ss"));
                }
                else if (TimeSpan.TryParse(Value.ToString(), out TS))
                {
                    return(TS.Hours.ToString("D2") + ":" + TS.Minutes.ToString("D2") + ":" + TS.Seconds.ToString("D2"));
                }
                else
                {
                    DT = Convert.ToDateTime(Value);
                    return(DT.ToString("HH:mm:ss"));
                }

            case "time.tz":
                if (Value is TimeSpan TS2)
                {
                    return(TS2.Hours.ToString("D2") + ":" + TS2.Minutes.ToString("D2") + ":" + TS2.Seconds.ToString("D2"));
                }
                else if (Value is DateTime DT5)
                {
                    return(DT5.ToString("HH:mm:ss"));
                }
                else if (Value is DateTimeOffset DTO2)
                {
                    string   s    = DTO2.ToString("HH:mm:ss");
                    TimeSpan Zone = DTO2.Offset;

                    if (Zone < TimeSpan.Zero)
                    {
                        s   += "-";
                        Zone = -Zone;
                    }
                    else
                    {
                        s += "+";
                    }

                    return(s + Zone.Hours.ToString("D2") + ":" + Zone.Minutes.ToString("D2"));
                }
                else if (TimeSpan.TryParse(Value.ToString(), out TS))
                {
                    return(TS.Hours.ToString("D2") + ":" + TS.Minutes.ToString("D2") + ":" + TS.Seconds.ToString("D2"));
                }
                else
                {
                    DT = Convert.ToDateTime(Value);
                    return(DT.ToString("HH:mm:ss"));
                }

            case "boolean":
                if (!(Value is bool b))
                {
                    b = Convert.ToBoolean(Value);
                }

                return(b ? "1" : "0");

            case "bin.base64":
                if (!(Value is byte[] Bin))
                {
                    Bin = SerializeToBinary(Value);
                }

                return(Convert.ToBase64String(Bin, Base64FormattingOptions.None));

            case "bin.hex":
                Bin = Value as byte[];
                if (Bin is null)
                {
                    Bin = SerializeToBinary(Value);
                }

                StringBuilder sb = new StringBuilder();

                foreach (byte b2 in Bin)
                {
                    sb.Append(b2.ToString("X2"));
                }

                return(sb.ToString());
            }
        }
 public ActionResult <DTO2> PostOrder(DTO2 obj)
 {
     return(new DTO2());
 }