コード例 #1
0
        public void PersistirAtualizar()
        {
            ContaPagar i = ContaPagarDao.BuscarPorId(ContaPagarDao.getLastId());

            i.Valor  = 22;
            i.Data   = DateTime.Now;
            i.Compra = CompraDao.BuscarPorId(CompraDao.getLastId());

            Assert.IsTrue(ContaPagarDao.Persistir(i));
        }
コード例 #2
0
        public void PersistirInserir()
        {
            ContaPagar i = new ContaPagar();

            i.Valor  = 11;
            i.Data   = Convert.ToDateTime("2001/05/20");
            i.Compra = CompraDao.BuscarPorId(CompraDao.getLastId());

            Assert.IsTrue(ContaPagarDao.Persistir(i));
        }
コード例 #3
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                ContaPagar i = new ContaPagar();
                i.Valor  = Convert.ToDecimal(collection["Valor"]);
                i.Data   = Convert.ToDateTime(collection["Data"]);
                i.Compra = CompraDao.BuscarPorId(Convert.ToInt32(collection["Compra.Id"]));

                ContaPagarDao.Persistir(i);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }