Example #1
0
        public IActionResult New(int petId)
        {
            var userId = _userManager.GetUserId(HttpContext.User);

            var watchlist = new Watchlist {
                PetId  = petId,
                UserId = userId
            };

            _watchlistRepository.Create(watchlist);

            _clientNotification
            .AddSweetNotification("Success", "Pet has been added to watchlist", NotificationType.success);

            return(RedirectToAction(nameof(Index)));
        }