public DTO.Funcionario CreateNewFuncionario(DTO.Funcionario funcionario) { using (var db = new BancoEmpresaEntities()) { var FuncionarioRow = db.tblFuncionario.Create(); FuncionarioRow.nldSetor = funcionario.nldSetor; FuncionarioRow.sCargo = funcionario.sCargo; FuncionarioRow.sCPF = funcionario.sCPF; FuncionarioRow.sSalario = funcionario.Money; FuncionarioRow.sNome = funcionario.sNome; FuncionarioRow.sNascimento = funcionario.dNascimento; db.tblFuncionario.Add(FuncionarioRow); db.SaveChanges(); funcionario.nldFuncionario = FuncionarioRow.nldFuncionario; return(funcionario); } }
public List <DTO.Setor> GetAllSetors() { using (var db = new BancoEmpresaEntities()) { return(db.tblSetor.Select(c => new DTO.Setor { nldSetor = c.nldSetor, sSetor = c.sSetor }).ToList()); } }
public DTO.Setor CreateNewSetor(DTO.Setor setor) { using (var db = new BancoEmpresaEntities()) { var SetorRow = db.tblSetor.Create(); SetorRow.sSetor = setor.sSetor; db.tblSetor.Add(SetorRow); db.SaveChanges(); setor.nldSetor = SetorRow.nldSetor; return(setor); } }