public ActionResult Create(OrcamentoViewModel orcamentoViewModel, decimal Valor) { try { var orcamento = Mapeador.Mapear <OrcamentoViewModel, Orcamento>(orcamentoViewModel); _gerenciadorDeOrcamento.Salvar(orcamento); return(RedirectToAction("Index")); } catch { return(View()); } }
// POST: Create public HttpResponseMessage Post(Orcamento orcamento) { HttpResponseMessage response; try { _gerenciadorDeOrcamento.Salvar(orcamento); response = Request.CreateResponse(HttpStatusCode.OK, orcamento); } catch (Exception ex) { response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex); } return(response); }
public void Salvar() { _orcamentoServiceMock.Setup(x => x.Add(It.IsAny <Orcamento>())).Returns(OrcamentoStub.NovaDespesa()); _orcamentoServiceMock.Setup(x => x.Save()); Assert.IsTrue(_gerenciadorDeOrcamento.Salvar(It.IsAny <Orcamento>())); }