public async Task CreateOrUpdateProductPriceLevel(ProductPriceLevelInput input) { if (input.Id == 0) { await CreateProductPriceLevel(input); } else { await UpdateProductPriceLevel(input); } }
public virtual async Task UpdateProductPriceLevel(ProductPriceLevelInput input) { var productPricelevel = input.MapTo <ProductPricelevel>(); var query = _ProductPricelevelRepository.GetAll().Where(p => (p.ProductId == input.ProductId && p.PriceLevelId == input.PriceLevelId) && p.Id != input.Id).FirstOrDefault(); if (query == null) { await _ProductPricelevelRepository.UpdateAsync(productPricelevel); } else { throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in Product Pricelevel..."); } }