public ActionResult Edit([Bind(Include = "dev_Id,fact_Id,dev_Razon,dev_Fecha,dev_UsuarioCrea,dev_FechaCrea,dev_UsuarioModifica,dev_FechaModifica")] tbDevolucion tbDevolucion) { // tbDevolucion.dev_UsuarioCrea = 3; // tbDevolucion.dev_FechaCrea = DateTime.Now; tbDevolucion.dev_UsuarioModifica = 3; tbDevolucion.dev_FechaModifica = DateTime.Now; IEnumerable <object> listDevolucion = null; string MensajeError = ""; if (ModelState.IsValid) { try { listDevolucion = db.UDP_Vent_tbDevolucion_Update(tbDevolucion.dev_Id, tbDevolucion.fact_Id, tbDevolucion.dev_Razon, tbDevolucion.dev_Fecha, tbDevolucion.dev_UsuarioCrea, tbDevolucion.dev_FechaCrea, tbDevolucion.dev_UsuarioModifica, tbDevolucion.dev_FechaModifica); foreach (UDP_Vent_tbDevolucion_Update_Result Resultado in listDevolucion) { MensajeError = Resultado.MensajeError; } if (MensajeError.StartsWith("-1")) { ModelState.AddModelError("", "No se pudo ingresar el registro, contacte al administrador"); return(View(tbDevolucion)); } } catch (Exception ex) { ex.Message.ToString(); } return(RedirectToAction("Index")); } ViewBag.dev_UsuarioCrea = new SelectList(db.tbUsuarios, "usu_Id", "usu_NombreUsuario", tbDevolucion.dev_UsuarioCrea); ViewBag.dev_UsuarioModifica = new SelectList(db.tbUsuarios, "usu_Id", "usu_NombreUsuario", tbDevolucion.dev_UsuarioModifica); ViewBag.fact_Id = new SelectList(db.tbFactura, "fact_Id", "fact_Id", tbDevolucion.fact_Id); return(View(tbDevolucion)); }