public async Task CreateOrUpdatePriceLevelProduct(CreatePriceLevelProductInput input) { if (input.Id == 0) { await CreatePriceLevelProduct(input); } else { await UpdatePriceLevelProduct(input); } }
public async Task CreatePriceLevelProduct(CreatePriceLevelProductInput input) { input.TenantId = (int)_session.TenantId; var quey = input.MapTo <PriceLevelProduct>(); var val = _PriceLevelProductRepository .GetAll().Where(p => p.ProductId == input.ProductId && p.PriceLevelId == input.PriceLevelId).FirstOrDefault(); if (val == null) { await _PriceLevelProductRepository.InsertAsync(quey); } else { throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in PriceLevel"); } }