コード例 #1
0
        public ActionResult AddDiscussao()
        {
            var discussao = new Discussao()
            {
                Dono  = LoginUtils.Instance.Usuario,
                Ativo = true
            };

            var topicos    = DbFactory.Instance.TopicoRepository.BuscarPelaSituacao(true);
            var selTopicos = new SelectList(topicos, "Id", "Titulo");

            ViewBag.Topicos = selTopicos;

            return(View(discussao));
        }
コード例 #2
0
        public ActionResult GravarDiscussao(Discussao discussao, Guid idTopico)
        {
            var topico = DbFactory.Instance.TopicoRepository.FindFirstById(idTopico);

            if (topico != null)
            {
                discussao.Ativo   = true;
                discussao.Dono    = LoginUtils.Instance.Usuario;
                discussao.Topico  = topico;
                discussao.Criacao = DateTime.Now;

                DbFactory.Instance.DiscussaoRepository.SaveOrUpdate(discussao);
            }

            return(RedirectToAction("Discussoes"));
        }