Exemplo n.º 1
0
        public List <Models.Response.GerenteResponse.ListarFuncResponse> listarGerentes()
        {
            Models.TccContext socorro = new Models.TccContext();

            List <Models.TbEmpregado> socorro1 = socorro.TbEmpregado.Where(x => x.DsCargo == "funcionario").Include(x => x.IdLoginNavigation).ToList();

            Utils.ConversorGerenteUtils.ConversorGerenteUtils         final = new Utils.ConversorGerenteUtils.ConversorGerenteUtils();
            List <Models.Response.GerenteResponse.ListarFuncResponse> a     = final.lists(socorro1);

            return(a);
        }
Exemplo n.º 2
0
        public Models.Response.GerenteResponse.FuncionarioGerenteResponse cadastrarfunc(Models.Request.RequestGerente.RequestGerente req)
        {
            Models.TccContext db = new Models.TccContext();
            Utils.ConversorGerenteUtils.ConversorGerenteUtils modelotb           = new Utils.ConversorGerenteUtils.ConversorGerenteUtils();
            Utils.ConversorGerenteUtils.GerarEmailFuncionario gerarnovoemailfunc = new Utils.ConversorGerenteUtils.GerarEmailFuncionario();

            Models.TbLogin novoemail = gerarnovoemailfunc.criaremailfunc(req);
            db.TbLogin.Add(novoemail);
            db.SaveChanges();

            Models.TbEmpregado novofunc = modelotb.ConvertReqparaTbEmpregado(req, novoemail);
            db.TbEmpregado.Add(novofunc);
            db.SaveChanges();

            Models.Response.GerenteResponse.FuncionarioGerenteResponse result = modelotb.ConverttbparaResponse(novofunc);
            return(result);
        }