public static bool Actualizar(M_Carrito c) { var result = false; try { var db = new EcomerceEntities(); var x = db.Carrito.SingleOrDefault(k => k.ID == c.ID); if (x != null) { x.IDCliente = c.IDCliente; x.IDProducto = c.IDProducto; db.SaveChanges(); result = true; return(result); } else { return(result); } } catch (Exception ex) { return(false); throw; } }
public static bool Actualizar(M_Categorias c) { var result = false; try { var db = new EcomerceEntities(); var x = db.Categorias.SingleOrDefault(k => k.ID == c.ID); if (x != null) { x.Nombre = c.Nombre; db.SaveChanges(); result = true; return(result); } else { return(result); } } catch (Exception ex) { return(false); throw; } }
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 static bool Actualizar(M_MetodosPago c) { var result = false; try { var db = new EcomerceEntities(); var x = db.MetodosPago.SingleOrDefault(k => k.ID == c.ID); if (x != null) { x.IDCliente = c.IDCliente; x.Nombre = c.Nombre; x.Empresa = c.Empresa; x.NumTarjeta = c.NumTarjeta; x.CCV = c.CCV; db.SaveChanges(); result = true; return(result); } else { return(result); } } catch (Exception ex) { return(false); throw; } }
public static bool Actualizar(M_Usuarios c) { var result = false; try { var db = new EcomerceEntities(); var x = db.Usuarios.SingleOrDefault(k => k.ID == c.ID); if (x != null) { x.Nombre = c.Nombre; x.Tipo = c.Tipo; x.Nombre = c.Nombre; x.Apellido = c.Apellido; x.usuario = c.usuario; x.contraseña = c.contraseña; db.SaveChanges(); result = true; return(result); } else { return(result); } } catch (Exception ex) { return(false); throw; } }
public static bool Actualizar(M_Clientes c) { var result = false; try { var db = new EcomerceEntities(); var x = db.Clientes.SingleOrDefault(k => k.ID == c.ID); if (x != null) { x.Nombre = c.Nombre; x.Apellido = c.Apellido; x.Telefono = c.Telefono; x.CorreoE = c.CorreoE; db.SaveChanges(); result = true; return(result); } else { return(result); } } catch (Exception ex) { return(false); throw; } }
public static bool Guardar(M_Clientes c) { try { var db = new EcomerceEntities(); var x = ConvertirHaciaBaseDatos(c); db.Clientes.Add(x); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); throw; } }
public static bool Guardar(M_Categorias c) { try { var db = new EcomerceEntities(); var x = ConvertToDBTable(c); db.Categorias.Add(x); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); throw; } }
static void Main(string[] args) { //codigo para pruebas M_Clientes GuardarCliente = new M_Clientes(); GuardarCliente.Nombre = "Pedro"; GuardarCliente.Apellido = "Lopez"; GuardarCliente.Telefono = "94959493"; GuardarCliente.CorreoE = "*****@*****.**"; var db = new EcomerceEntities(); var x = ClasesFunciones.ClientesFunciones.ConvertirHaciaBaseDatos(GuardarCliente); db.Clientes.Add(x); db.SaveChanges(); //codigo para pruebas }