Esempio n. 1
0
        public StringBothWays ReverseString(StringBothWays text)
        {
            for (int i = text.Original.Length - 1; i >= 0; i--)
            {
                text.Backwards += text.Original[i];
            }

            return(text);
        }
        public ActionResult ReversingAString(TwoWayString stringModel)
        {
            if (ModelState.IsValid)
            {
                var reverser = new StringReverser();
                var text     = new StringBothWays();
                text.Original        = stringModel.Forward;
                text                 = reverser.ReverseString(text);
                stringModel.Reversed = text.Backwards;
                return(View("ReversingAString", stringModel));
            }

            return(View("ReversingAString"));
        }