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(); }
public async Task AssignProviderTypeProduct(ProviderJoinProduct providerJoinProduct) { await _context.ProviderJoinProducts.AddAsync(providerJoinProduct); }
public ProviderJoinProductResponse(ProviderJoinProduct providerJoinProduct) : this(true, string.Empty, providerJoinProduct) { }
public ProviderJoinProductResponse(bool success, string message, ProviderJoinProduct providerJoinProduct) : base(success, message) { ProviderJoinProduct = providerJoinProduct; }