public async Task <IActionResult> Post(PostLogin model) { var TokenApi = new Token { TokenDef = _config.GetValue <string>("Token:TokenDef") }; try { var login = await _repo.GetVendedorByUserAsync(model.Usuario); if (login == null) { return(NotFound()); } if (login.Senha == model.Senha) { login.Token = TokenApi.TokenDef; return(this.StatusCode(StatusCodes.Status200OK, login)); } else { return(this.StatusCode(StatusCodes.Status401Unauthorized, "Senha invalida")); } } catch (System.Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Banco de Dados Falhou.{ex.Message}")); } }