public HttpResponseMessage Post(CategoriaFinanceiraViewModel categoriaFinanceiraViewModel)
        {
            if (ModelState.IsValid)
            {
                _categoriaFinanceiraApp.Add(categoriaFinanceiraViewModel);

                return(Request.CreateResponse(HttpStatusCode.Created, categoriaFinanceiraViewModel));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
        }
        public HttpResponseMessage Put(CategoriaFinanceiraViewModel categoriaFinanceiraViewModel)
        {
            if (ModelState.IsValid)
            {
                _categoriaFinanceiraApp.Update(categoriaFinanceiraViewModel);

                return(Request.CreateResponse(HttpStatusCode.Created, "Cadastro efetuado com sucesso!"));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
        }
Esempio n. 3
0
        public void Update(CategoriaFinanceiraViewModel categoriaFinanceiraViewModel)
        {
            var categoria = Mapper.Map <CategoriaFinanceiraViewModel, CategoriaFinanceira>(categoriaFinanceiraViewModel);

            BeginTransaction();
            _categoriaFinanceiraService.Update(categoria);

            _logSistemaService.AddLog("CategoriaFinanceira", categoriaFinanceiraViewModel.CategoriaFinanceiraId, "Update", "");
            Commit();
        }