Created
January 30, 2020 09:40
-
-
Save AmyrAhmady/19ba30d894595ac7209b108b5b8a7f81 to your computer and use it in GitHub Desktop.
mamad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using InstagramApiSharp.API.Builder; | |
using InstagramApiSharp.API; | |
using InstagramApiSharp; | |
using InstagramApiSharp.Classes; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Threading.Tasks; | |
namespace WebApplication1.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
IInstaApi InstaApi; | |
public ActionResult Index() | |
{ | |
return View(); | |
} | |
public ActionResult About() | |
{ | |
ViewBag.Message = "Your application description page."; | |
return View(); | |
} | |
public async Task<ActionResult> Contact() | |
{ | |
await Login(); | |
var currentUser = await InstaApi.UserProcessor.GetCurrentUserAsync(); | |
ViewBag.Message = "Your contact page. " + currentUser.Value.Email; | |
return View(); | |
} | |
public async Task<IResult<InstaLoginResult>> Login() | |
{ | |
var user = new UserSessionData(); | |
user.UserName = "horiasghari"; | |
user.Password = "321654hori"; | |
InstaApi = InstaApiBuilder.CreateBuilder() | |
.SetUser(user) | |
.Build(); | |
return await InstaApi.LoginAsync(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment