public ActionResult AddSurgery_Or_Trauma(int category, string name, string date, string observations) { Patologias p = new Patologias(); p.Nombre = name; p.Categoria = category; p.idpaciente = idPatient; p.Fecha = date; p.Observaciones = observations; DB.Patologias.Add(p); DB.SaveChanges(); return(Json(p, JsonRequestBehavior.AllowGet)); }
public ActionResult ChangePassword(ChangePwd model) { if (Session["IdPatient"] == null) { return(RedirectToAction("FirstAccess", "LogIn")); } if (ModelState.IsValid) { var reg = (from r in DB.Registro join p in DB.Paciente on r.idRegistro equals p.IdRegistro where p.idPaciente == idPatient select r).FirstOrDefault(); if (reg != null) { if (reg.clave == model.oldPassword) { if (model.newPassword == model.newPassword2) { reg.clave = model.newPassword; DB.SaveChanges(); model.success = true; } else { model.errorNewPassword = true; } } else { model.errorOldPassword = true; } } else { return(RedirectToAction("FirstAccess", "LogIn")); } } else { model.errorFields = true; } return(View(model)); }
public ActionResult Agree() { if (_SessionId != null) { using (var DB = new emeciEntities()) { var Data = (from p in DB.Paciente where p.idPaciente == _SessionId.Value select p).FirstOrDefault(); if (Data != null) { Data.acepto = true; DB.SaveChanges(); } } } return(Json(new { status = "ok" }, JsonRequestBehavior.AllowGet)); }