public static SimpleDishDTO CreateFromDomainWithAssociatedTables(Dish d) { var dish = CreateFromDomain(d); if (dish == null) { return(null); } dish.Promotion = SimplePromotionDTO.CreateFromDomain(d.Promotion); return(dish); }
public static DishDTO CreateFromDomainWithAssociatedTables(Dish d) { var dish = CreateFromDomain(d); if (dish == null) { return(null); } dish.Promotion = SimplePromotionDTO.CreateFromDomain(d.Promotion); dish.Ingredients = d.DishIngredients.Select(IngredientDTO.CreateFromDishIngredientDomain).ToList(); dish.Rating = d.RatingLogs.Any() ? Rating.CreateWithComments(d.RatingLogs) : null; return(dish); }