Пример #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);
        }
Пример #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"));
        }
Пример #3
0
 protected Repository()
 {
     context = new EmuzerDbContext();
 }