Advertisement
Guest User

Untitled

a guest
Oct 27th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 KB | None | 0 0
  1. using RDWebApplication.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Http;
  7. using WebIntegration.Models;
  8. using System.Text;
  9. using System.Net;
  10. using System.Net.Http;
  11. using System.Net.Http.Headers;
  12. using RDWebApplication.Utils;
  13. using System.Threading.Tasks;
  14.  
  15. namespace RDWebApplication.Controllers
  16. {
  17.     [RoutePrefix("api/leads")]
  18.     public class LeadsController : ApiController
  19.     {
  20.  
  21.         private String username = "ciro.zanata";
  22.         private String password = "Randon@2017";
  23.         private String c4cUrlGetToken = "https://my312452.crm.ondemand.com/sap/c4c/odata/cust/v1/z_leads/LeadInputCollection/$count";
  24.         private String c4cUrlSendPost = "https://my312452.crm.ondemand.com/sap/c4c/odata/cust/v1/z_leads/LeadInputCollection";
  25.         private RDSUtils rdsUtils;
  26.        
  27.  
  28.         [HttpPost]
  29.         [Route("")]
  30.         public RDRootObjectcs readJsonPost([FromBody] RDRootObjectcs leads)
  31.         {
  32.             //verificar campos faltando
  33.             //verificar retorno de erros
  34.             //gerar logs
  35.             convertObject(leads);
  36.            
  37.             return leads;
  38.         }
  39.  
  40.         [HttpPost]
  41.         [Route("teste")]
  42.         public String teste()
  43.         {
  44.             rdsUtils = new RDSUtils();
  45.             String retornoPost = rdsUtils.sendJson(username, password, c4cUrlSendPost, takeToken());
  46.             return retornoPost + " hahaua";
  47.         }
  48.  
  49.         public String takeToken()
  50.         {
  51.             rdsUtils = new RDSUtils();
  52.             String token = rdsUtils.takeToken(username,password, c4cUrlGetToken);
  53.             return token;
  54.         }
  55.      
  56.  
  57.         public String convertObject(RDRootObjectcs leads)
  58.         {
  59.             rdsUtils = new RDSUtils();
  60.         //    rdsUtils.convertRDObjectToC4CObject(leads);
  61.  
  62.             return " ";
  63.         }
  64.        
  65.        
  66.  
  67.  
  68.  
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement