public ActionResult Edit(ProjetoViewModel projetoViewModel)
 {
     if (!ModelState.IsValid)
     {
         return(View(projetoViewModel));
     }
     _projetoAppService.Update(projetoViewModel);
     return(RedirectToAction("Index"));
 }
        public IActionResult Put([FromBody] ProjetoViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(new BadRequestObjectResult(ModelState.GenerateValidation()));
                }


                if (unitOfw.CadeiaRepository.Count(y => y.Id == model.CadeiaId) == 0)
                {
                    BaseViewModel <string> notFound = new BaseViewModel <string>("Cadeia Not Found!");
                    return(Ok(notFound));
                }
                var erros = _projetoService.Validate(model.UnidadeMedidaId);
                if (erros.Count > 0)
                {
                    return(Ok(erros));
                }


                var projeto = _projetoService.Update(model);

                if (projeto == null)
                {
                    return(Ok("Projeto not found!"));
                }
                //var projeto = unitOfw.ProjetoRepository.Update(model);

                BaseViewModel <object> baseObj = new BaseViewModel <object>(projeto, "Projeto Saved Successfully!", "");
                return(Ok(baseObj));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message.ToString()));
            }
        }