Пример #1
0
        /// <summary>
        /// Update WishList
        /// </summary>
        /// <param name="catalogItemId"></param>
        /// <param name="notifyCasePriceChanges"></param>
        /// <returns></returns>
        public async Task <IActionResult> OnPostUpdate(int catalogItemId, bool notifyCasePriceChanges)
        {
            WishListModel = await _wishListViewModelService.GetOrCreateWishListForUser(User.Identity.Name);

            var WishItem = WishListModel.Items.Where(x => x.CatalogItemId == catalogItemId).FirstOrDefault();

            if (WishItem != null && WishItem.NotifyCasePriceChanges != notifyCasePriceChanges)
            {
                await _wishListService.SetNotifies(WishListModel.Id, catalogItemId, notifyCasePriceChanges);

                WishListModel = await _wishListViewModelService.GetOrCreateWishListForUser(User.Identity.Name);
            }
            return(RedirectToPage());
        }