public ActionResult Delete(int id) { using (var db = new BD_PracticaEntities()) { var oUser = db.Usuario.Find(id); oUser.IdEstado = 3; db.Entry(oUser).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Content("1")); }
public ActionResult Edit(EditUsuarioViewModel model) { if (!ModelState.IsValid) { return(View(model)); } using (var db = new BD_PracticaEntities()) { var oUser = db.Usuario.Find(model.IdUsuario); oUser.Email = model.Email; oUser.Edad = model.Edad; if (model.Password != null && model.Password.Trim() != "") { oUser.Password = model.Password; } db.Entry(oUser).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect(Url.Content("~/Usuario/Inicio"))); }