Exemplo n.º 1
0
        public async Task <IActionResult> Add(AddAlbumViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Add", model));
            }

            var user = await _userManager.GetUserAsync(HttpContext.User);

            User  myUser = _repository.GetUser(user.Id);
            Album album  = new Album(myUser, model.Name);

            // myUser.Albums.Add(album); BAZU popraviti
            await _repository.AddMyAlbumAsync(album);

            return(RedirectToAction("Index"));
        }