public ActionResult Edit(EditarProfesionViewModels vm) { try { if (ModelState.IsValid) { var Editar = db.Profesiones.Find(vm.id); string desc = vm.profesion; if (desc.ToUpper() != Editar.Desc_Profesion.ToString().ToUpper()) { if (ValidaProfesion(desc) == false) { Editar.Desc_Profesion = vm.profesion; db.Entry(Editar).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } return(View()); } // TODO: Add update logic here } catch { return(View()); } return(View()); }
public ActionResult Edit(int id) { var profesion = db.Profesiones.Find(id); if (profesion == null) { return(HttpNotFound()); } var ViewModel = new EditarProfesionViewModels() { profesion = profesion.Desc_Profesion }; return(View(ViewModel)); }