Esempio n. 1
0
 public IHttpActionResult GetId(int id)
 {
     try
     {
         BLPaquete bl       = new BLPaquete();
         SPaquete  p        = bl.getPaquete(id);
         string    rolToken = TokenInfo.getClaim(Request, "role");
         if (rolToken == "Cliente")
         {
             string    emailToken = TokenInfo.getClaim(Request, "email");
             BLCliente blc        = new BLCliente();
             SCliente  c          = blc.getClienteByEmail(emailToken);
             if (p.IdDestinatario == c.Id || p.IdRemitente == c.Id)
             {
                 return(Ok(p));
             }
             else
             {
                 throw new ECompartida("Alto ahi maleante! No tienes acceso a esta informacion");
             }
         }
         else
         {
             return(Ok(p));
         }
     }
     catch (Exception e)
     {
         return(Content(HttpStatusCode.InternalServerError, e.Message));
     }
 }