public async Task <bool> AddProduct(AddProductDto productdto) { Product adedproduct = productdto.Adapt <Product>(); await _context.Products.AddAsync(adedproduct); await _context.SaveChangesAsync(); if (!await _categoryManager.AddProductCategoryRelation(productdto.CategoryId, adedproduct.ProductId)) { throw new Exception("Product And Category Relation Requried"); } if (!await _stockManager.SetStockPropertyCombination(productdto.CategoryId, adedproduct.ProductId)) { throw new Exception("Product Variation Requried"); } if (!await AddProductImages(productdto.Images, adedproduct.ProductId)) { throw new Exception("Product Images Requried"); } //ProductElasticIndexDto productElasticIndexDto = new ProductElasticIndexDto(); //productElasticIndexDto.Adapt(adedproduct); //await CreateIndexes(productElasticIndexDto); return(await Task.FromResult <bool>(true)); }