public ActionResult Index() { var model = new HomeIndexModel(); GetAlgorithms(model); return View(model); }
private void GetAlgorithms(HomeIndexModel model) { var valAlgs = Validation .ValidationAlgorithms .Select(va => new SelectListItem { Text = va.Name, Value = va.Id.ToString() }); model.ValidationAlgorithms.AddRange(valAlgs); var decryptAlgs = Decryption .DecryptionAlgorithms .Select(da => new SelectListItem { Text = da.Name, Value = da.Id.ToString() }); model.DecryptionAlgorithms.AddRange(decryptAlgs); }
public ActionResult Index(HomeIndexModel model) { if (!Request.IsAjaxRequest()) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "AJAX Only"); } if (!ModelState.IsValid) { return Json(new { success = false }); } model.MachineKey = _machineKeySvc.GenerateMachineKey(model.SelectedValidationId.Value, model.SelectedDecryptionId.Value); return Json( new { success = true, machineKey = model.MachineKey }); }