Пример #1
0
        // GET /TbUniversidadePerfil/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
            try
            {
                ModelApiUnes _db = new ModelApiUnes();
                Dictionary <string, string> queryString = Request.GetQueryNameValuePairs().ToDictionary(x => x.Key, x => x.Value);


                if (Permissoes.Autenticado(token, _db))
                {
                    return(GatewayTbUniversidadePerfil.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);
            }
        }
Пример #2
0
 public void Delete(string token, Int32 UNP_ID_PERFIL)
 {
     // Abre nova conexão
     using (ModelApiUnes _db = new ModelApiUnes())
     {
         try
         {
             if (Permissoes.Autenticado(token, _db))
             {
                 GatewayTbUniversidadePerfil.Delete(token, UNP_ID_PERFIL, _db);
             }
             //else
             //    return new Retorno() { Token = false }; //throw new Exception("Unauthorized");
         }
         catch (Exception e)
         {
             throw new Exception(e.Message);
         }
     }
 }
Пример #3
0
 public void Put(string token, [FromBody] TB_UNIVERSIDADE_PERFIL param)
 {
     // Abre nova conexão
     using (ModelApiUnes _db = new ModelApiUnes())
     {
         try
         {
             if (Permissoes.Autenticado(token, _db))
             {
                 GatewayTbUniversidadePerfil.Update(token, param, _db);
             }
             //else
             //    return new Retorno() { Token = false }; //throw new Exception("Unauthorized");
         }
         catch (Exception e)
         {
             throw new Exception(e.Message);
         }
     }
 }
Пример #4
0
 public long Post(string token, [FromBody] TB_UNIVERSIDADE_PERFIL param)
 {
     // Abre nova conexão
     using (ModelApiUnes _db = new ModelApiUnes())
     {
         try
         {
             if (Permissoes.Autenticado(token, _db))
             {
                 return(GatewayTbUniversidadePerfil.Add(token, param, _db));
             }
             else
             {
                 return(0); //throw new Exception("Unauthorized");
             }
         }
         catch (Exception e)
         {
             throw new Exception(e.Message);
         }
     }
 }