/// <summary> /// Add a restaurant, including any associated reviews. /// </summary> /// <param name="restaurant">The restaurant</param> public void AddRestaurant(Library.Models.Restaurant restaurant) { if (restaurant.Id != 0) { s_logger.Warn($"Restaurant to be added has an ID ({restaurant.Id}) already: ignoring."); } s_logger.Info($"Adding restaurant"); Restaurant entity = Mapper.MapRestaurantWithReviews(restaurant); entity.Id = 0; _dbContext.Add(entity); }
/// <summary> /// Add a restaurant, including any associated reviews. /// </summary> /// <param name="restaurant">The restaurant</param> public void AddRestaurant(Domain.Model.Restaurant restaurant) { if (restaurant.Id != 0) { _logger.LogWarning("Restaurant to be added has an ID ({restaurantId}) already: ignoring.", restaurant.Id); } _logger.LogInformation("Adding restaurant"); Restaurant entity = Mapper.MapRestaurantWithReviews(restaurant); entity.Id = 0; _dbContext.Add(entity); }