Ejemplo n.º 1
0
        public void ChangeImageRepo(string userId, ChangeProfilePictureInputModel newImage)
        {
            var change = (from u in _db.userAccounts
                          where u.aspUserId == userId
                          select u).FirstOrDefault();

            change.picture = newImage.picture;
            _db.SaveChanges();
        }
        public async Task <IActionResult> ChangeProfileImage(ChangeProfilePictureInputModel input)
        {
            var user = await this.userManager.FindByIdAsync(input.UserId);

            if (this.User.Identity.Name != user.UserName)
            {
                return(this.NotFound());
            }

            user.ProfileImageUrl = await this.Upload(input.ImageUpload);

            await this.userManager.UpdateAsync(user);

            return(this.RedirectToAction("Details", "Profile", new { id = input.UserId }));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> ChangeProfilePicture(ChangeProfilePictureInputModel newImage)
        {
            if (ModelState.IsValid)
            {
                var user = await GetCurrentUserAsync();

                var userId = user?.Id;
                if (userId == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                _accountServices.changeImageServ(userId, newImage);
            }
            return(RedirectToAction("Details", "Account"));
        }
Ejemplo n.º 4
0
 public void changeImageServ(string UserId, ChangeProfilePictureInputModel newImage)
 {
     _accountRepo.ChangeImageRepo(UserId, newImage);
 }