public IList <Clientes> FindClientesCPF(string CPF) { try { using (SGCCContext c = new SGCCContext()) { return(c.Clientes.Where(x => x.CPF == CPF).ToList()); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public IList <Clientes> FindClientes(string Nome) { try { using (SGCCContext c = new SGCCContext()) { return(c.Clientes.Where(x => x.Nome.Contains(Nome)).ToList()); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void Update(Clientes clientes) { try { using (SGCCContext c = new SGCCContext()) { c.Entry(clientes).State = EntityState.Modified; c.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void Insert(Clientes clientes) { try { using (SGCCContext c = new SGCCContext()) { c.Clientes.Add(clientes); c.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void delete(int id) { try { using (SGCCContext c = new SGCCContext()) { c.Clientes.Remove(c.Clientes.Find(id)); c.SaveChanges(); } } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public IList <Clientes> FindClientes(int Id) { try { using (SGCCContext c = new SGCCContext()) { return(c.Clientes.Where(x => x.Id == Id).ToList()); //var result =(IList<Clientes>) c.Clientes.Find(Id); //return result; } } catch (Exception ex) { throw new Exception(ex.ToString()); } }