public async Task <ActionResult> ObterUsuario(string UserName) { try { var user = await _service.ObterUsuario(UserName); if (user.Role == "Adm") { var results = _mapper.Map <AdmDto>(user); return(Ok(results)); } else { var results = _mapper.Map <UserDto>(user); return(Ok(results)); } } catch (BusinessException e) { if (e.Message.Equals("user not found")) { return(Ok("user not found")); } return(BadRequest()); } catch (DbConcurrencyException e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de dados Falhou")); } }