public async Task <IActionResult> PromotionByShopId()
        {
            var message       = TempData["message"];
            var userId        = HttpContext.Session.GetInt32("userid").Value;
            var shopProfileId = (await _shopProfileService.RetrieveShopProfileByUserIdAsync(userId))?.ShopProfileId;
            var promotion     = await _promotionService.RetrievePromotionByShopIdAsync((int)shopProfileId);

            var promotionViewModel = new PromotionViewModel {
                Promotions = promotion, Message = message?.ToString() ?? string.Empty
            };

            return(View("Index", promotionViewModel));
        }
Пример #2
0
        public async Task <IActionResult> Index()
        {
            int    userId   = HttpContext.Session.GetInt32("userid").Value;
            string userName = HttpContext.Session.GetString("username");

            ShopProfile result = await _shopProfileService.RetrieveShopProfileByUserIdAsync(userId);

            if (result == null)
            {
                ShopProfile shopProfile = new ShopProfile
                {
                    UserId = userId
                };

                result = await _shopProfileService.InsertAsync(shopProfile);
            }

            return(View(new ShopProfileViewModel {
                ShopProfileDto = result
            }));
        }