public IActionResult Protect(ProtectionData model) { if (!string.IsNullOrEmpty(model.PlainText)) { model.CipherText = _protector.Protect(model.PlainText); } model.PlainText = string.Empty; return RedirectToAction("Index", new RouteValueDictionary(model)); }
public IActionResult Unprotect(ProtectionData model) { try { if (!string.IsNullOrEmpty(model.CipherText)) { model.PlainText = _protector.Unprotect(model.CipherText); } model.CipherText = string.Empty; return RedirectToAction("Index", new RouteValueDictionary(model)); } catch (Exception e) { model.Error = e; return View("Index", model); } }
public IActionResult Index(ProtectionData model) { return View(model); }