comparison Agendas/trunk/src/Agendas.Web/Controllers/PerfilController.cs @ 115:7a2eeb9e9bf9

Crear cuenta interna asociada
author Nelo@Kenia.neluz.int
date Sun, 12 Jun 2011 01:40:09 -0300
parents 1ce71844ffa4
children 62dc9fb3a03e
comparison
equal deleted inserted replaced
114:1ce71844ffa4 115:7a2eeb9e9bf9
56 { 56 {
57 var action = Url.Action("AddTwitterAccount"); 57 var action = Url.Action("AddTwitterAccount");
58 var url = Request.Url.Scheme + "://" + Request.Url.Host + 58 var url = Request.Url.Scheme + "://" + Request.Url.Host +
59 (Request.Url.Port != 80 ? ":" + Request.Url.Port : string.Empty) + action; 59 (Request.Url.Port != 80 ? ":" + Request.Url.Port : string.Empty) + action;
60 60
61 Response.Redirect(oAuth.AuthorizationLinkGet(url).ToString()); 61 return Redirect(oAuth.AuthorizationLinkGet(url).ToString());
62 } 62 }
63 else 63
64 var response = oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
65 if (response.Length > 0)
64 { 66 {
65 var response = oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]); 67 var username = OAuthTwitter.GetResponseContent(response, "screen_name");
66 if (response.Length > 0)
67 {
68 var username =OAuthTwitter.GetResponseContent(response, "screen_name");
69 68
70 var personaService = AgendaFactory.GetPersonaService(); 69 var personaService = AgendaFactory.GetPersonaService();
71 70
72 personaService.AddCuenta(IdentityProviderEnum.Twitter, username); 71 personaService.AddCuenta(IdentityProviderEnum.Twitter, username);
73 return RedirectToAction("Index"); 72 return RedirectToAction("Index");
74 }
75 } 73 }
76 return RedirectToAction("Index"); 74 return RedirectToAction("Index");
77 } 75 }
78 76
79 public ActionResult AddBuiltInAccount() 77 public ActionResult AddBuiltInAccount()