// POST: teste
        public ActionResult _SalvarTeste(TesteModel model)
        {
            TesteBC.SalvarTeste(model.ParaDTO());

            //var modelGrid = TesteBC.CarregarDados();
            return(PartialView("_ExibirTeste"));
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TesteModel testeModel = db.TesteModels.Find(id);

            db.TesteModels.Remove(testeModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "NR_CARGA,NR_SEQ,DT_PROCESSAMENTO,CD_CPF_CNPJ,SG_TP_PESSOA,CD_CPF_CNPJ_PESSOA,PF_PJ_PESSOA,CD_SOLVERE_OPER,DS_PAPEL,NM_PESSOA,NR_DDD,NR_TELEFONE,NR_DDD_CELULAR,NR_CELULAR,NM_EMAIL_SOCIO,NM_CONTATO_SOCIO,NM_GRUPO_ECONOMICO,NM_CONJUGE,NM_LOGRADOURO,NR_LOGRADOURO,NM_COMPLEMENTO,NM_BAIRRO,NM_CIDADE,SG_UF,NM_PAIS")] TesteModel testeModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(testeModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(testeModel));
 }
        //[HttpGet]
        //public string Index()
        //{
        //    return "Teste controller Index";
        //}

        //[HttpGet]
        //public string TesteTask()
        //{
        //    return "Teste controller";
        //}

        // GET: TesteController
        public ActionResult Index(string name, int age)
        {
            //https://localhost:44396/teste?name=Anildo&age=32
            TesteModel teste = new TesteModel();

            teste.Name = name;
            teste.Age  = age;

            return(View("TesteIndex", teste));
        }
 public ActionResult Edit([Bind(Include = "cod_teste,texto")] TesteModel testeModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(testeModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(testeModel));
 }
        public ActionResult Create([Bind(Include = "cod_teste,texto")] TesteModel testeModel)
        {
            if (ModelState.IsValid)
            {
                db.TesteModels.Add(testeModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(testeModel));
        }
Example #7
0
 public void Inserir(TesteModel teste)
 {
     try
     {
         uow.BeginTransacao();
         uow.Inseri(teste);
         uow.CommitTransacao();
     }
     catch (Exception ex)
     {
         uow.RollbackTransacao();
     }
 }
Example #8
0
        // GET: TesteModels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TesteModel testeModel = db.TesteModels.Find(id);

            if (testeModel == null)
            {
                return(HttpNotFound());
            }
            return(View(testeModel));
        }
Example #9
0
        public IActionResult Alterar(TesteModel model, [FromServices] IFuncionarioRepository repository, [FromServices] IMapper mapper)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var funcionario = mapper.Map <FuncionarioEntity>(model);
                    repository.Update(funcionario);

                    return(Ok("Deu Certo!"));
                }
                catch (Exception e)
                {
                    return(StatusCode(500, e.Message));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
Example #10
0
 public void Salvar(TesteModel teste)
 {
     service.Inserir(teste);
 }