public async Task AddImageAsync(int id, BreadFile image) { BLL.Restaurant bllRestaurant = await restaurantRepository.GetAsync(id); string restaurantPath = Path.Combine(storageOptions.RestaurantUploadsAbsolutePath, bllRestaurant.Name); string imagePath = await uploadsHandler.PersistAsync(restaurantPath, image); bllRestaurant.ImagePath = Path.Combine(GetRestaurantUploadsUrl(), imagePath).Replace("\\", "/"); await restaurantRepository.UpdateAsync(bllRestaurant); }
public async Task AddImageAsync(int id, BreadFile image) { BLL.Product bllProduct = await productRepository.GetAsync(id); if (bllProduct == null) { return; } BLL.Restaurant bllRestaurant = await restaurantRepository.GetAsync(bllProduct.RestaurantId); string productsPath = Path.Combine(storageOptions.RestaurantUploadsAbsolutePath, bllRestaurant.Name, ProductsFolderName); string imagePath = await uploadsHandler.PersistAsync(productsPath, image); bllProduct.ImagePath = Path.Combine(GetRestaurantUploadsUrl(bllRestaurant.Name), imagePath).Replace("\\", "/"); await productRepository.UpdateAsync(bllProduct); }