Exemple #1
0
        public static string GetProfilePicturePath(this IIdentity identity)
        {
            EmuzerDbContext db      = new EmuzerDbContext();
            var             userId  = identity.GetUserId();
            var             user    = db.Users.FirstOrDefault(u => u.Id == userId);
            var             picture = user.ProfilePicture;

            return(picture.FilePath);
        }
Exemple #2
0
        public ActionResult GetFacebookPicture()
        {
            var db = new EmuzerDbContext();

            var userId = User.Identity.GetUserId();
            var user   = db.Users.FirstOrDefault(u => u.Id == userId);

            user.ProfilePicture.FilePath =
                GetFacebookInformation.GetPictureUrl(
                    user?.Logins?.FirstOrDefault(l => l.LoginProvider == "Facebook")?.ProviderKey);

            user.ProfilePicture.ProviderType = PictureProviderType.Facebook;

            if (!string.IsNullOrEmpty(user.ProfilePicture.FilePath))
            {
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Exemple #3
0
 protected Repository()
 {
     context = new EmuzerDbContext();
 }