public void GuardarModificarControlMaterialDetalle(CONTROL_MATERIAL_DETALLE model) { using (ASIS_PRODEntities entities = new ASIS_PRODEntities()) { var detalle = entities.CONTROL_MATERIAL_DETALLE.FirstOrDefault(x => x.IdControlMaterialDetalle == model.IdControlMaterialDetalle); if (detalle != null) { detalle.TotalMaterial = model.TotalMaterial; detalle.BuenEstado = model.BuenEstado; detalle.DadoBaja = model.DadoBaja; detalle.Observacion = model.Observacion; entities.SaveChanges(); } } }
public ActionResult GuardarControlDetalle(CONTROL_MATERIAL_DETALLE model) { try { lsUsuario = User.Identity.Name.Split('_'); if (string.IsNullOrEmpty(lsUsuario[0])) { return(Json("101", JsonRequestBehavior.AllowGet)); } if (model.IdControlMaterialDetalle == 0) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; return(Json("Faltan Parametros", JsonRequestBehavior.AllowGet)); } clsDControlMaterialQuebradizo = new clsDControlMaterialQuebradizo(); if (model.EstadoRegistro == clsAtributos.EstadoRegistroInactivo) { model.TotalMaterial = 0; model.BuenEstado = 0; model.DadoBaja = 0; } model.FechaIngresoLog = DateTime.Now; model.UsuarioIngresoLog = lsUsuario[0]; model.TerminalIngresoLog = Request.UserHostAddress; clsDControlMaterialQuebradizo.GuardarModificarControlMaterialDetalle(model); return(Json("1", JsonRequestBehavior.AllowGet)); } catch (DbEntityValidationException e) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), null, e); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Response.StatusCode = (int)HttpStatusCode.InternalServerError; clsDError = new clsDError(); lsUsuario = User.Identity.Name.Split('_'); string Mensaje = clsDError.ControlError(lsUsuario[0], Request.UserHostAddress, this.ControllerContext.RouteData.Values["controller"].ToString(), "Metodo: " + this.ControllerContext.RouteData.Values["action"].ToString(), ex, null); return(Json(Mensaje, JsonRequestBehavior.AllowGet)); } }