Example #1
0
        public async Task <IActionResult> Put(Guid id, [FromBody] GrupoFormViewModel model)
        {
            if (!await _grupoService.Existe(id))
            {
                return(RegistroNaoEncontrado(id));
            }

            var result = await _grupoService.Editar(id, _mapper.Map <Grupo>(model));

            if (result.IsValid)
            {
                return(Ok(_mapper.Map <GrupoViewModel>(result.Entity)));
            }

            return(BadRequest(result.Result));
        }