public static bool Guardar(Clientes cliente) { bool retorno = false; try { using (var db = new BeautyBaseDB()) { if (Buscar(cliente.ClienteID) == null) { db.Cliente.Add(cliente); } else { db.Entry(cliente).State = EntityState.Modified; } db.SaveChanges(); } retorno = true; } catch (Exception) { throw; } return(retorno); }
public static bool Insertar(Empleados employes) { bool retorno = false; using (var Conn = new BeautyBaseDB()) { try { var e = Buscar(employes.EmpleadosID); if (e == null) { Conn.Empleado.Add(employes); } else { Conn.Entry(employes).State = EntityState.Modified; } Conn.SaveChanges(); retorno = true; } catch (Exception) { throw; } } return(retorno); }
public static Clientes Buscar(int id) { Clientes client = new Clientes(); using (BeautyBaseDB db = new BeautyBaseDB()) { client = db.Cliente.Find(id); } return(client); }
public static List <Empleados> GetListaId(int EmpleadosId) { List <Empleados> list = new List <Empleados>(); using (var db = new BeautyBaseDB()) { try { list = db.Empleado.Where(p => p.EmpleadosID == EmpleadosId).ToList(); } catch (Exception) { throw; } } return(list); }
public static List <Empleados> GetLista() { var lista = new List <Empleados>(); using (var conexion = new BeautyBaseDB()) { try { lista = conexion.Empleado.ToList(); } catch (Exception) { throw; } } return(lista); }
public static Empleados Buscar(int Id) { var c = new Empleados(); using (var Conn = new BeautyBaseDB()) { try { c = Conn.Empleado.Find(Id); } catch (Exception) { throw; } } return(c); }
public static bool Eliminar(Empleados employes) { bool resultado = false; using (var Conn = new BeautyBaseDB()) { try { Conn.Entry(employes).State = EntityState.Deleted; Conn.SaveChanges(); resultado = true; /// } catch (Exception) { throw; } } return(resultado); }