コード例 #1
0
        public async Task <IActionResult> Post([FromBody] GrupoFormViewModel model)
        {
            var entity = _mapper.Map <Grupo>(model);

            var result = await _grupoService.Cadastrar(entity);

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

            return(BadRequest(result.Result));
        }