コード例 #1
0
ファイル: FavoritesController.cs プロジェクト: kRaBby/HEH_BE
        public async Task <ActionResult> RemoveAsync(Guid discountId)
        {
            if (await _discountValidationService.DiscountExists(discountId) &&
                await _favoritesValidationService.UserFavoritesNotExists(discountId))
            {
                await _favoritesService.RemoveAsync(discountId);

                return(Ok());
            }

            return(NotFound());
        }
コード例 #2
0
        public async Task <ActionResult <DiscountExtendedDto> > GetAsync(Guid id)
        {
            if (!await _discountValidationService.DiscountExists(id))
            {
                return(NotFound());
            }

            var discount = await _discountService.GetByIdAsync(id);

            await _statisticsService.IncrementViewsAmountAsync(id);

            return(Ok(discount));
        }