public ActionResult Editar(EstadoViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var estado = viewModel.Model();
                _repositorioDeEstados.Atualizar(estado);

                return(RedirectToAction("Index"));
            }

            return(View(viewModel));
        }
        public HttpResponseMessage Put(int id, EstadoViewModel estado)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            if (id != estado.Id)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            _repositorioDeEstados.Atualizar(estado.Model());

            return(Request.CreateResponse(HttpStatusCode.OK));
        }