コード例 #1
0
ファイル: ProductTagService.cs プロジェクト: zaj-e/WebBackend
        public async Task <ProductTagResponse> AssignProductTagAsync(int productId, int tagId)
        {
            try
            {
                await _productTagRepository.AssignProductTag(productId, tagId);

                await _unitOfWork.CompleteAsync();
            }
            catch (Exception ex)
            {
                return(new ProductTagResponse($"An error ocurred while assigning Product and Tag: {ex.Message}"));
            }

            return(new ProductTagResponse(await _productTagRepository.FindByProductIdAndTagId(productId, tagId)));
        }
コード例 #2
0
        public async Task <ProductTagResponse> AssingProductTagAsync(int ptoductId, int tagId)
        {
            try
            {
                await _productTagRepository.AssingProductTag(ptoductId, tagId);

                await _unitOfWork.CompleteAsync();

                ProductTag productTag = await _productTagRepository.FindByProductIdAndTagId(ptoductId, tagId);

                return(new ProductTagResponse(productTag));
            }
            catch (Exception e)
            {
                return(new ProductTagResponse($"An error ocurred while assinging Tag to Product: {e.Message}"));
            }
        }