public async Task <ActionResult> GetAllSentPrivateMessagesByUserAsync()
        {
            var userId          = _claimsGetter.UserId(User?.Claims);
            var privateMessages = await _privateMessagesService.GetAllSentPrivateMessagesByUserAsync(userId);

            return(Ok(privateMessages));
        }
Esempio n. 2
0
        public async Task <ActionResult> GetAllByShopIdAsync()
        {
            var userId = _claimsGetter.UserId(User?.Claims);
            var shop   = await _usersService.GetShopByUserIdAsync(userId);

            var productCategoriesForShop = await _productCategoriesService.GetAllByShopIdAsync(shop.Id);

            return(Ok(productCategoriesForShop));
        }
Esempio n. 3
0
        public async Task <ActionResult> GetShopOrdersAsync()
        {
            var userId = _claimsGetter.UserId(User?.Claims);
            var shop   = await _usersService.GetShopByUserIdAsync(userId);

            var shopId = shop.Id;
            var orders = await _ordersService.GetShopOrdersAsync(shopId);

            return(Ok(orders));
        }
Esempio n. 4
0
        public void ClaimsGetter_UserId_Returns_Actual_UserId()
        {
            //Arrange

            //Act
            var claimId = claimsGetter.UserId(Claims);

            //Assert
            claimId.Should().Be(User.Id);
        }
        public async Task <ActionResult> AddAsync(int categoryId)
        {
            var userId = _claimsGetter.UserId(User?.Claims);
            var shop   = await _usersService.GetShopByUserIdAsync(userId);

            ShopCategoryViewModel shopCategory = new ShopCategoryViewModel {
                CategoryId = categoryId, ShopId = shop.Id
            };

            await _shopCategoriesService.SaveAsync(shopCategory);

            return(NoContent());
        }
        public async Task <ActionResult> AddAsync(ShopCommentViewModel shopComment)
        {
            shopComment.AddedById = _claimsGetter.UserId(User?.Claims);
            await _shopCommentsService.SaveAsync(shopComment);

            return(NoContent());
        }
Esempio n. 7
0
        //[HttpGet("{id}")]
        public async Task <ActionResult> GetByIdAsync()
        {
            var userId   = _claimsGetter.UserId(User?.Claims);
            var userById = await _usersService.GetByIdAsync(userId);

            return(Ok(userById));
        }