public ActionResult SecondAccess(AccessByCoordinate model) { ViewBag.coordinate = coordinate; if (ModelState.IsValid) { var inf = (from p in DB.Paciente join r in DB.Registro on p.IdRegistro equals r.idRegistro join d in DB.DatosTarjeta on r.Emeci equals d.noTarjeta where r.Emeci == cardNumber && d.Dato == model.coordinate && d.Coordenada == coordinate.Replace(",", "") select new { p, r }).FirstOrDefault(); if (inf != null) { Session.Add("IdPatient", inf.p.idPaciente); Session.Add("IdRegister", inf.r.idRegistro); return(RedirectToAction("GeneralInfo", "Expedient")); } else { model.accessDenied = true; } } else { model.accessDenied = true; } return(View(model)); }
public ActionResult SecondAccess() { if (Session["IdPatient"] != null) { return(RedirectToAction("GeneralInfo", "Expedient")); } var model = new AccessByCoordinate(); int num = new Random().Next(1, 10); int lyric = new Random().Next(65, 74); coordinate = (char)lyric + "," + num; ViewBag.coordinate = coordinate; return(View(model)); }