예제 #1
0
        public ActionResult Index()
        {
            VMBase64 vmIndex = new VMBase64();

            ViewBag.Base64ConvertType = EnumToSelectList <Base64ConvertType, byte>(vmIndex.Type);
            return(View(vmIndex));
        }
예제 #2
0
        public ActionResult Decode()
        {
            VMBase64 vmEncode = new VMBase64
            {
                Type = Base64ConvertType.Base64ToString
            };

            return(View(vmEncode));
        }
예제 #3
0
        public ActionResult Index(VMBase64 vmIndex)
        {
            switch (vmIndex.Type)
            {
            case Base64ConvertType.StringToBase64:
                return(RedirectToAction("Encode", vmIndex));

            case Base64ConvertType.Base64ToString:
                return(RedirectToAction("Decode", vmIndex));

            default:
                return(View(vmIndex));
            }
        }
예제 #4
0
 public ActionResult Decode(VMBase64 vmDecode)
 {
     ModelState.Remove("Destination");
     vmDecode.Destination = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(vmDecode.Source));
     return(View(vmDecode));
 }
예제 #5
0
 public ActionResult Encode(VMBase64 vmEncode)
 {
     ModelState.Remove("Destination");
     vmEncode.Destination = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(vmEncode.Source));
     return(View(vmEncode));
 }