Ejemplo n.º 1
0
        public ActionResult Index()
        {
            VMBase64 vmIndex = new VMBase64();

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

            return(View(vmEncode));
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 4
0
 public ActionResult Decode(VMBase64 vmDecode)
 {
     ModelState.Remove("Destination");
     vmDecode.Destination = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(vmDecode.Source));
     return(View(vmDecode));
 }
Ejemplo n.º 5
0
 public ActionResult Encode(VMBase64 vmEncode)
 {
     ModelState.Remove("Destination");
     vmEncode.Destination = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(vmEncode.Source));
     return(View(vmEncode));
 }