public IActionResult Decrypt(FileInfoModel model) { //Validate model.Encrypt = false; Validate(model); if (!ModelState.IsValid) { return(View(model)); } InitializeTextLoader(model); //Do the work textLoader.Decrypt(machine); //Redirect return(Redirect("/Action/Result")); }
public IActionResult Text(RawTextModel model) { //Validate if (!IsKeyValid(model.Key)) { ModelState.AddModelError("Invalid Key", "Invalid Key, must have only russian letters!"); } if (!ModelState.IsValid) { return(View(model)); } //Redirect textLoader = new SimpleTextLoader(model.Text, model.Encoding); machine.Key = model.Key; if (model.Encrypt) { textLoader.Encrypt(machine); } else { textLoader.Decrypt(machine); } return(Redirect("/Action/Result")); }