public new Pessoa add(Pessoa pes) { using (_context = new FreelancerSpaceContext()) { _context.Pessoas.Add(pes); _context.SaveChanges(); } return(pes); }
public bool edit(T item) { using (_context = new FreelancerSpaceContext()) { try { _context.Entry(item).State = EntityState.Modified; _context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
public bool add(T item) { using (_context = new FreelancerSpaceContext()) { try { _context.Set <T>().Add(item); _context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } }
public Usuario add(string username, string senha) { Usuario user = new Usuario(); try { user = new Usuario() { Ativo = "S", IdGrupoAcesso = 1, Senha = senha, Username = username }; using (_context = new FreelancerSpaceContext()) { _context.Usuarios.Add(user); _context.SaveChanges(); } return(user); } catch (Exception ex) { return(user); throw; } }