public async Task <ApiResponse> CreateMultipleProduct([FromBody] List <ProductDtos> dto) { try { List <ProductViewModel> vm = new List <ProductViewModel>(); var products = _mapper.Map <List <Product> >(dto); await _productService.AddManyAsync(products); foreach (var product in products) { if (product.Id != Guid.Empty) { var productVm = _productService.GetProductCategoriesSizes(product.Id); var productMapVm = _mapper.Map <ProductViewModel>(productVm); vm.Add(productMapVm); } } var productDtos = _mapper.Map <List <ProductViewModel> >(vm); return(new ApiResponse("", productDtos, 200)); } catch (Exception ex) { return(new ApiResponse("Can't add product", ex, 400)); } }