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_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 List <M_Usuarios> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.Usuarios.ToList(); List <M_Usuarios> MiLista = new List <M_Usuarios>(); foreach (var item in Lista) { MiLista.Add(new M_Usuarios { ID = item.ID, Tipo = item.Tipo, Nombre = item.Nombre, Apellido = item.Apellido, usuario = item.usuario, contraseña = item.contraseña }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); throw; } }
public static List <M_Direcciones> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.Direcciones.ToList(); List <M_Direcciones> MiLista = new List <M_Direcciones>(); foreach (var item in Lista) { MiLista.Add(new M_Direcciones { ID = item.ID, IDCliente = item.IDCliente, Direccion = item.Direccion, }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); 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 List <M_Carrito> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.Carrito.ToList(); List <M_Carrito> MiLista = new List <M_Carrito>(); foreach (var item in Lista) { MiLista.Add(new M_Carrito { ID = item.ID, IDCliente = item.IDCliente, IDProducto = item.IDProducto }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); throw; } }
public static List <M_ListaPedido> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.ListaPedido.ToList(); List <M_ListaPedido> MiLista = new List <M_ListaPedido>(); foreach (var item in Lista) { MiLista.Add(new M_ListaPedido { IDPedido = item.IDPedido, IDProducto = item.IDProducto, cantidad = item.cantidad, }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); throw; } }
public static List <M_Productos> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.Productos.ToList(); List <M_Productos> MiLista = new List <M_Productos>(); foreach (var item in Lista) { MiLista.Add(new M_Productos { ID = item.ID, NombreProducto = item.NombreProducto, Descripcion = item.Descripcion, Precio = item.Precio, IDCategoria = item.IDCategoria, Existencias = item.Existencias, Foto = item.Foto }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); throw; } }
public static List <M_Categorias> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.Categorias.ToList(); List <M_Categorias> MiLista = new List <M_Categorias>(); foreach (var item in Lista) { MiLista.Add(new M_Categorias { ID = item.ID, Nombre = item.Nombre, }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); 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_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 List <M_Clientes> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.Clientes.ToList(); List <M_Clientes> MiLista = new List <M_Clientes>(); foreach (var item in Lista) { MiLista.Add(new M_Clientes { ID = item.ID, Nombre = item.Nombre, Apellido = item.Apellido, Telefono = item.Telefono, CorreoE = item.CorreoE }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); throw; } }
public static List <M_MetodosPago> ObtenerTodos() { try { var db = new EcomerceEntities(); var Lista = db.MetodosPago.ToList(); List <M_MetodosPago> MiLista = new List <M_MetodosPago>(); foreach (var item in Lista) { MiLista.Add(new M_MetodosPago { ID = item.ID, IDCliente = item.IDCliente, Nombre = item.Nombre, Empresa = item.Empresa, NumTarjeta = item.NumTarjeta, CCV = item.CCV, }); } return(MiLista == null ? null : MiLista); } catch (Exception ex) { return(null); throw; } }
public static bool Existe(int id) { try { var db = new EcomerceEntities(); var e = db.Categorias.Any(x => x.ID == id); return(e); } catch (Exception ex) { return(false); } }
public static M_Clientes ObtenerxId(int id) { try { var db = new EcomerceEntities(); var x = db.Clientes.Where(k => k.ID == id).FirstOrDefault(); return(x == null ? null : ConvertiraModelo(x)); } catch (Exception ex) { return(null); throw; } }
public static M_Categorias ObtenerxId(int id) { try { var db = new EcomerceEntities(); var x = db.Categorias.Where(k => k.ID == id).FirstOrDefault(); return(x == null ? null : ConvertToDomain(x)); } catch (Exception ex) { return(null); 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 }