public ActionResult Create(ItemValorViewModel itemValorViewModel)
        {
            try
            {
                var itemValor = Mapeador.Mapear <ItemValorViewModel, ItemValor>(itemValorViewModel);
                _gerenciadorDeItemValor.Salvar(itemValor);

                return(RedirectToAction("Index", new { id = itemValorViewModel.Orcamento.Id }));
            }
            catch
            {
                return(View());
            }
        }
Example #2
0
        // POST: Create
        public HttpResponseMessage Post(ItemValor itemValor)
        {
            HttpResponseMessage response;

            try
            {
                _gerenciadorDeItemValor.Salvar(itemValor);

                response = Request.CreateResponse(HttpStatusCode.OK, itemValor);
            }
            catch (Exception ex)
            {
                response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex);
            }

            return(response);
        }
 public void Salvar()
 {
     _itemValorServiceMock.Setup(x => x.Add(It.IsAny <ItemValor>())).Returns(ItemValorStub.NovoItemValor());
     _itemValorServiceMock.Setup(x => x.Save());
     Assert.IsTrue(_gerenciadorDeItemValor.Salvar(It.IsAny <ItemValor>()));
 }