public ActionResult <string> GetEncrypt(string method, string str, string key) { try { if (method == "caesar") { Caesar caesar = new Caesar(); var result = caesar.Encode(str, key); if (result.Item2 == true) { SaveEncryptItems(method, str, key, result.Item1); return(result.Item1); } } else if (method == "railfence") { RailFence railFence = new RailFence(); var result = railFence.Encode(str, key); if (result.Item2 == true) { SaveEncryptItems(method, str, key, result.Item1); return(result.Item1); } } else if (method == "affine") { Affine affine = new Affine(); var result = affine.Encode(str, key); if (result.Item2 == true) { SaveEncryptItems(method, str, key, result.Item1); return(result.Item1); } } else if (method == "substitution") { Substitution substitution = new Substitution(); var result = substitution.Encode(str, key); if (result.Item2 == true) { SaveEncryptItems(method, str, key, result.Item1); return(result.Item1); } } } catch (System.Exception e) { return(e.Message); } return("No such method!"); }