Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated MVC quick start

  • Loading branch information...
commit 90e731ce07fc5603d108ca06426793c4350406d1 1 parent 814ac54
@bbaia bbaia authored
View
20 examples/Spring.MvcQuickStart/Spring.MvcQuickStart/Controllers/FacebookController.cs
@@ -46,6 +46,26 @@ public ActionResult Callback(string code)
Session["AccessGrant"] = accessGrant;
+ IFacebook facebookClient = facebookProvider.GetApi(accessGrant.AccessToken);
+ FacebookProfile profile = facebookClient.UserOperations.GetUserProfile();
+ return View(profile);
+ }
+
+ // GET: /Facebook/UpdateStatus
+ public ActionResult UpdateStatus()
+ {
+ return View();
+ }
+
+ // POST: /Facebook/UpdateStatus
+ [HttpPost]
+ public ActionResult UpdateStatus(string status)
+ {
+ AccessGrant accessGrant = Session["AccessGrant"] as AccessGrant;
+ IFacebook facebookClient = facebookProvider.GetApi(accessGrant.AccessToken);
+
+ facebookClient.FeedOperations.UpdateStatus(status);
+
return View();
}
}
View
3  examples/Spring.MvcQuickStart/Spring.MvcQuickStart/Spring.MvcQuickStart.2010-NET40.csproj
@@ -114,6 +114,9 @@
<Name>Spring.Social.Facebook.2010-NET40</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Content Include="Views\Facebook\UpdateStatus.cshtml" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
8 examples/Spring.MvcQuickStart/Spring.MvcQuickStart/Views/Facebook/Callback.cshtml
@@ -1,7 +1,11 @@
-@{
+@model Spring.Social.Facebook.Api.FacebookProfile
+@{
ViewBag.Title = "Callback";
}
-<h2>Welcome !</h2>
+<h2>Welcome @Model.FirstName @Model.LastName!</h2>
+
+@Html.ActionLink("Update your status", "UpdateStatus")
+
View
16 examples/Spring.MvcQuickStart/Spring.MvcQuickStart/Views/Facebook/UpdateStatus.cshtml
@@ -0,0 +1,16 @@
+@{
+ ViewBag.Title = "Update Facebook's status";
+}
+
+<h2>Facebook</h2>
+<p>
+ Update your Facebook's status.
+</p>
+
+@using (Html.BeginForm()) {
+ <div>
+ <input type="text" name="status" />
+ <input type="submit" value="Send" />
+ </div>
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.