//POST:// public ActionResult ModificarcmMedico(HistorialMedico_Usuarios historialU) { #region ViewBag List <SelectListItem> lst = new List <SelectListItem>(); lst.Add(new SelectListItem { Text = "Si", Value = "1" }); lst.Add(new SelectListItem { Text = "No", Value = "2" }); ViewBag.Opciones = lst; #endregion HistorialMedico historial = historialU.historialMedicO; historial.IDUsuario = (int)TempData["id"]; if (ModelState.IsValid) { historial = Cliente.ModificarHM(historial); return(RedirectToAction("medidasMantenimiento")); } return(View(historial)); }
//GET:// public ActionResult ModificarcmMedico(int?id) { #region ViewBag var viewalcochol = Cliente.retornaViewBags(id); var viewfumado = Cliente.retornaViewBags(id); var viewhipertension = Cliente.retornaViewBags(id); var viewdiabetes = Cliente.retornaViewBags(id); ViewBag.Alcohol = new SelectList(viewalcochol, "alcohol", "alcohol"); ViewBag.Fumado = new SelectList(viewfumado, "fumado", "fumado"); ViewBag.Hipertension = new SelectList(viewhipertension, "hipertension", "hipertension"); ViewBag.Diabetes = new SelectList(viewdiabetes, "diabetes", "diabetes"); #endregion HistorialMedico_Usuarios modelo = new HistorialMedico_Usuarios(); if (id == null) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); } modelo.historialMedicO = Cliente.visualizarHM(id); modelo.usuarios = Usuario.getUser((int)id); TempData["id"] = id; return(View(modelo)); }