public async Task <ProviderJoinProductResponse> AssignProviderProduct(int providerId, int typeproductId)
        {
            try
            {
                var providerBD    = _providerRepository.FindByIdAsync(providerId);
                var typeproductBD = _typeProductRepository.FindByIdAsync(typeproductId);

                ProviderJoinProduct providerJoinProduct = new ProviderJoinProduct();
                // providerJoinProduct.Provider = providerBD.Result;
                providerJoinProduct.ProviderId = providerId;
                //  providerJoinProduct.TypeProduct = typeproductBD.Result;
                providerJoinProduct.TypeProductId = typeproductId;

                await _providerJoinProductRepository.AssignProviderTypeProduct(providerJoinProduct);

                await _unitOfWork.CompleteAsync();

                return(new ProviderJoinProductResponse(providerJoinProduct));
            }
            catch (Exception ex)
            {
                return(new ProviderJoinProductResponse($"An error ocurred while assigning service to provider: {ex.Message}"));
            }

            throw new NotImplementedException();
        }
예제 #2
0
 public async Task AssignProviderTypeProduct(ProviderJoinProduct providerJoinProduct)
 {
     await _context.ProviderJoinProducts.AddAsync(providerJoinProduct);
 }
예제 #3
0
 public ProviderJoinProductResponse(ProviderJoinProduct providerJoinProduct) : this(true, string.Empty, providerJoinProduct)
 {
 }
예제 #4
0
 public ProviderJoinProductResponse(bool success, string message, ProviderJoinProduct providerJoinProduct) : base(success, message)
 {
     ProviderJoinProduct = providerJoinProduct;
 }