public static bool Actualizar(M_Productos c) { var result = false; try { var db = new EcomerceEntities(); var x = db.Productos.SingleOrDefault(k => k.ID == c.ID); if (x != null) { x.NombreProducto = c.NombreProducto; x.Descripcion = c.Descripcion; x.Precio = c.Precio; x.IDCategoria = c.IDCategoria; x.Existencias = c.Existencias; x.Foto = c.Foto; db.SaveChanges(); result = true; return(result); } else { return(result); } } catch (Exception ex) { return(false); throw; } }
public HttpResponseMessage Guardar([FromBody] M_Productos c) { try { if (ValidarAutorizacion()) { var x = ProductosRepositorio.Guardar(c); if (x == false) { return(OkResponse("Hubo un error al recuperar el registro")); } else { return(OkResponse(x)); } } else { return(OkResponse("No tiene acceso")); } } catch (Exception) { return(ErrorResponse("Ha ocurrido un error")); throw; } }
public HttpResponseMessage Actualizar([FromBody] M_Productos a) { try { if (ValidarAutorizacion()) { var x = ProductosRepositorio.Actualizar(a); if (x == false) { return(OkResponse("Hubo un error al tratar de actualizar")); } else { return(OkResponse(x)); } } else { return(OkResponse("No tiene acceso")); } } catch (Exception) { return(ErrorResponse("Ha ocurrido un error")); throw; } }
public void Actualizar(M_Productos obj) { using (MonitorOperacionesEntities db = new MonitorOperacionesEntities()) { db.M_Productos.Attach(obj); db.Entry(obj).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public M_Productos Isertar(M_Productos obj) { using (MonitorOperacionesEntities db = new MonitorOperacionesEntities()) { db.M_Productos.Add(obj); db.SaveChanges(); return(obj); } }
public void Eliminar(M_Productos obj) { using (MonitorOperacionesEntities db = new MonitorOperacionesEntities()) { db.M_Productos.Attach(obj); db.M_Productos.Remove(obj); db.SaveChanges(); } }
public static Productos ConvertToDBTable(M_Productos c) { return(new Productos { ID = c.ID, NombreProducto = c.NombreProducto, Descripcion = c.Descripcion, Precio = c.Precio, IDCategoria = c.IDCategoria, Existencias = c.Existencias, Foto = c.Foto }); }
public static bool Guardar(M_Productos c) { try { var db = new EcomerceEntities(); var x = ConvertToDBTable(c); db.Productos.Add(x); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); throw; } }
//************** // Eventos del formulario //************** private void Grd_Detalles_CurrentCellChanged(object sender, EventArgs e) { if (BS_TablaMaestra.Position >= 0) { switch (Cmb_TablaMaestra.SelectedIndex) { case 0: // "Actividad Comercial" r_TablaMaestra0 = BS_TablaMaestra.Current as M_ActivComercial; break; case 1: // "Antigüedad" r_TablaMaestra1 = BS_TablaMaestra.Current as M_Antiguedad; break; case 2: // "Criptomonedas" r_TablaMaestra2 = BS_TablaMaestra.Current as M_Criptomonedas; break; case 3: // "Edad" r_TablaMaestra3 = BS_TablaMaestra.Current as M_Edad; break; case 4: // "Estados" r_TablaMaestra4 = BS_TablaMaestra.Current as M_Estados; break; case 5: // Nivel de Riesgo r_TablaMaestra5 = BS_TablaMaestra.Current as M_NivelRiesgo; break; case 6: // "Pais" r_TablaMaestra6 = BS_TablaMaestra.Current as M_Pais; break; case 7: // "P.E.P." r_TablaMaestra7 = BS_TablaMaestra.Current as M_PEP; break; case 8: // "Productos" r_TablaMaestra8 = BS_TablaMaestra.Current as M_Productos; break; case 9: // "Profesión" r_TablaMaestra9 = BS_TablaMaestra.Current as M_Profesiones; break; case 10: // "Servicios" r_TablaMaestra10 = BS_TablaMaestra.Current as M_Servicios; break; case 11: // "Tipo de Documento Identidad" r_TablaMaestra11 = BS_TablaMaestra.Current as M_TipoDocID; break; case 12: // "Tipo de Estructura" r_TablaMaestra12 = BS_TablaMaestra.Current as M_TipoEstructuraEmpresa; break; case 13: // "Tipo de Persona Jurídica" r_TablaMaestra13 = BS_TablaMaestra.Current as M_TipoPersJuridica; break; case 14: // "Vol. Oper. Pers. Natural" r_TablaMaestra14 = BS_TablaMaestra.Current as M_VolOperPersNat; break; case 15: // "Vol. Oper. Pers. Jurídica" r_TablaMaestra15 = BS_TablaMaestra.Current as M_VolOperPersJur; break; case 16: // "Vol. Oper. Pers. Jurídica" r_TablaMaestra16 = BS_TablaMaestra.Current as M_TipoOrdenes; break; case 17: // "Vol. Oper. Pers. Jurídica" r_TablaMaestra17 = BS_TablaMaestra.Current as M_Titulos; break; } } TSB_ActualizaBotonesNavegacion(); }
public static void Elimiar(M_Productos obj) { dmProductos.Eliminar(obj); }
public static void Actualizar(M_Productos obj) { dmProductos.Actualizar(obj); }
public static M_Productos Insertar(M_Productos obj) { return(dmProductos.Isertar(obj)); }