public ActionResult Criar(Assunto assunto)
        {
            using (var repo = new AssuntoRepository())
            {
                var inserido = repo.Inserir(assunto);

                if (inserido.Id == 0)
                {
                    ModelState.AddModelError("", "Erro");
                }
            }

            return(RedirectToAction("Index"));
        }
예제 #2
0
        private int InserirAssunto()
        {
            using (AssuntoRepository repo = new AssuntoRepository())
            {
                var assunto = new AssuntoCursoUsuario
                {
                    Nome = "Demo teste 1"
                };

                int id = repo.Inserir(assunto).IdCurso;

                Assert.IsTrue(id > 0);
                return(id);
            }
        }