예제 #1
0
        public AsciiResponse ProccessRequest(AsciiRequest request)
        {
            string original = request.stringToModify;

            char[] chars    = original.ToCharArray();
            string finalOut = "";

            foreach (char conversion in chars)
            {
                finalOut = finalOut + (Convert.ToInt32(conversion)) + " ";
            }

            AsciiResponse response = new AsciiResponse();

            response.originalString = original;
            response.modifiedString = finalOut;

            return(response);
        }
예제 #2
0
        public IActionResult AsciiControl([FromBody] AsciiRequest request)
        {
            AsciiResponse asciiResponse;

            try
            {
                //_bin.ValidateRequest(request);
                string[] words = request.stringToModify.Split(' ');

                Thread thread1 = new Thread(() => ControllerHelperFunctions.databaseWordTransaction(words, _DB));
                thread1.Start();

                asciiResponse = _ascii.ProccessRequest(request);
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }

            return(StatusCode(200, asciiResponse));
        }
예제 #3
0
 public void Setup()
 {
     request  = new AsciiRequest();
     response = new AsciiResponse();
     ascii    = new Ascii();
 }