示例#1
0
        public ListaNotasModel Salvar(NotasNovoModel model)
        {
            Nota nota = new Nota();

            nota.Titulo  = model.Titulo;
            nota.Empresa = new Empresa()
            {
                Id = model.EmpresaId
            };

            try
            {
                UnitOfWorkNHibernate.GetInstancia().IniciarTransacao();
                _iNotasServices.InsertNota(nota, User.Identity.Name);
                UnitOfWorkNHibernate.GetInstancia().ConfirmarTransacao();
            }
            catch (ExceptionMessage em)
            {
                UnitOfWorkNHibernate.GetInstancia().DesfazerTransacao();
                throw em;
            }
            catch (Exception ex)
            {
                UnitOfWorkNHibernate.GetInstancia().DesfazerTransacao();
                throw new StatusException("Erro interno . Favor informe ao administrador.");
            }

            ListaNotasModel lnm = new ListaNotasModel();

            lnm.EmpresaId         = model.EmpresaId;
            lnm.NotaSelecionadaId = nota.Id;

            return(lnm);
        }
示例#2
0
        public ActionResult Novo(int empresaId)
        {
            NotasNovoModel lm = new NotasNovoModel();

            lm.EmpresaId = empresaId;
            return(View(lm));
        }