public ActionResult Index() { VMBase64 vmIndex = new VMBase64(); ViewBag.Base64ConvertType = EnumToSelectList <Base64ConvertType, byte>(vmIndex.Type); return(View(vmIndex)); }
public ActionResult Decode() { VMBase64 vmEncode = new VMBase64 { Type = Base64ConvertType.Base64ToString }; return(View(vmEncode)); }
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)); } }
public ActionResult Decode(VMBase64 vmDecode) { ModelState.Remove("Destination"); vmDecode.Destination = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(vmDecode.Source)); return(View(vmDecode)); }
public ActionResult Encode(VMBase64 vmEncode) { ModelState.Remove("Destination"); vmEncode.Destination = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(vmEncode.Source)); return(View(vmEncode)); }