Beispiel #1
0
        public async Task <ActionResult <EntidadeViewModel> > Atualizar(Guid id, [FromBody] EntidadeViewModel entidadeViewModel)
        {
            if (id != entidadeViewModel.Id)
            {
                NotificarErro("O id informado não é o mesmo que foi passado na query");
                return(CustomResponse(entidadeViewModel));
            }

            if (!ModelState.IsValid)
            {
                return(CustomResponse(ModelState));
            }
            await _entidadeService.Atualizar(_mapper.Map <Entidade>(entidadeViewModel));

            return(CustomResponse(entidadeViewModel));
        }
Beispiel #2
0
        public async Task <ActionResult <EntidadeViewModel> > Put(EntidadeViewModel entidadeViewModel)
        {
            var objeto = _mapper.Map <Projeto>(entidadeViewModel);

            return(_mapper.Map <EntidadeViewModel>(await _entidadeService.Atualizar(objeto)));
        }