// GET /TbUsuarioAlias/token/colecao/campo/orderBy/pageSize/pageNumber?CAMPO1=VALOR&CAMPO2=VALOR public Retorno Get(string token, int colecao = 0, int campo = 0, int orderBy = 0, int pageSize = 0, int pageNumber = 0) { // Abre nova conexão using (ModelApiUnes _db = new ModelApiUnes()) { try { Dictionary <string, string> queryString = Request.GetQueryNameValuePairs().ToDictionary(x => x.Key, x => x.Value); if (Permissoes.Autenticado(token, _db)) { return(GatewayTbUsuarioAlias.Get(token, colecao, campo, orderBy, pageSize, pageNumber, queryString, _db)); } else { return new Retorno() { Token = false } }; //throw new Exception("Unauthorized"); } catch (Exception e) { throw new Exception(e.Message); } } }
// POST /TbUsuarioAlias/token/ public Retorno Post([FromBody] Login login) { // Abre nova conexão ModelApiUnes _db = new ModelApiUnes(); try { //Login login = (Login)formObj; //if (Permissoes.Autenticado(token, _db)) //{ return(GatewayTbUsuarioAlias.Autenticate(login.Senha, login.Usuario)); // } //else //{ ///return Request.CreateResponse(HttpStatusCode.Unauthorized); //} } catch (Exception e) { throw new Exception(e.Message); } }