public async Task AddAsync(Product product) { _builder.SetBuildingEntity(product, _schemes.Query.Include(x => x.FieldDefenitions) .Include(x => x.FieldDefenitionGroups) .Include(x => x.FieldDefenitionGroups.Select(fdg => fdg.FieldDefenitions)) .First(x => x.Id == product.SchemeId), _productCategories.Query .Include(x => x.FieldDefenitions) .Include(x => x.FieldDefenitionGroups) .Include(x => x.FieldDefenitionGroups.Select(fdg => fdg.FieldDefenitions)) .First(x => x.Id == product.PrimaryCategoryId) ); product = _builder.GetResult(); SanitizeAllowedQuantities(product); await HandleEshantionsAsync(product, product.Eshantions.ToList()); await HandleRequiredProductsAsync(product, product.Eshantions.ToList()); await HandleCrossSellingsAsync(product, product.CrossSellings.ToList()); await HandleUpSellingsAsync(product, product.UpSellings.ToList()); await HandleAssociatedProductsAsync(product, product.AssociatedProducts.ToList()); HandleDownLoadFileIfItIs(product); await _products.AddAsync(product); }
private async Task HandleAddition(Entity model) { var scheme = await _schemesDataSrv.GetAsync(model.SchemeId); var primaryCat = await _categoryDataService.Query.Include(x => x.FieldDefenitions) .Include(x => x.FieldDefenitionGroups) .Include(x => x.FieldDefenitionGroups.Select(fdg => fdg.FieldDefenitions)) .FirstAsync(x => x.Id == model.PrimaryCategoryId); _entityBuilder.SetBuildingEntity(model, scheme, primaryCat); var res = _entityBuilder.GetResult(); await _entityDataSrv.AddAsync(res); }