Exemple #1
0
        public async Task <IActionResult> Rename(RenameAlbumViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Rename", model));
            }
            ApplicationUser user = await _userManager.GetUserAsync(HttpContext.User);

            User  myUser = _repository.GetUser(user.Id);
            Album album  = await _repository.GetAlbumAsync(model.Id);

            album.Name = model.Name;
            await _repository.UpdateMyAlbumAsync(myUser, album);

            return(RedirectToAction("Index"));
        }