public ActionResult Delete(int id, ItemValorViewModel itemValorViewModel)
        {
            try
            {
                var itemValor = _gerenciadorDeItemValor.BuscarPorId(id);
                _gerenciadorDeItemValor.Excluir(itemValor);

                return(RedirectToAction("Index", new { id = itemValorViewModel.Orcamento.Id }));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 2
0
        // POST: Delete
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage response;

            try
            {
                var itemValor = _gerenciadorDeItemValor.BuscarPorId(id);
                _gerenciadorDeItemValor.Excluir(itemValor);

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

            return(response);
        }
 public void Excluir()
 {
     _itemValorServiceMock.Setup(x => x.Delete(It.IsAny <ItemValor>()));
     _itemValorServiceMock.Setup(x => x.Save());
     _gerenciadorDeItemValor.Excluir(ItemValorStub.ItemValor());
 }