Пример #1
0
        public MealPlanViewModel GetDisplay(int mealPlanId)
        {
            MealPlanViewModel mealPlanDisplay = new MealPlanViewModel();

            MealPlan mealPlan = Get(mealPlanId);

            mealPlanDisplay.MealPlanId     = mealPlan.MealPlanId;
            mealPlanDisplay.Description    = mealPlan.Description;
            mealPlanDisplay.PhotoFilePath  = mealPlan.PhotoFilePath;
            mealPlanDisplay.PrepTime       = mealPlan.PrepTime;
            mealPlanDisplay.PrepTimeUnit   = mealPlan.PrepTimeUnit;
            mealPlanDisplay.CostPerServing = mealPlan.CostPerServing;
            mealPlanDisplay.Active         = mealPlan.Active;
            mealPlanDisplay.Created        = (System.DateTime)mealPlan.Created;

            PreparationRepository preparationRepository = new PreparationRepository();

            mealPlanDisplay.Preparations = preparationRepository.GetDisplayList(mealPlanId);

            MealPlanAssignedCategoryRepository mealPlanAssignedCategoryRepository = new MealPlanAssignedCategoryRepository();

            mealPlanDisplay.MealPlanAssignedCategories = mealPlanAssignedCategoryRepository.GetDisplayList(mealPlanId);

            MealPlanAssignedDietPlanRepository mealPlanAssignedDietPlanRepository = new MealPlanAssignedDietPlanRepository();

            mealPlanDisplay.MealPlanAssignedDietPlans = mealPlanAssignedDietPlanRepository.GetDisplayList(mealPlanId);

            NutrientViewModel nutrientViewModel = new NutrientViewModel();

            mealPlanDisplay.NutrientDropDownList = nutrientViewModel.GetDropDownList();

            MealPlanAssignedNutrientRepository mealPlanAssignedNutrientRepository = new MealPlanAssignedNutrientRepository();

            mealPlanDisplay.MealPlanAssignedNutrients = mealPlanAssignedNutrientRepository.GetDisplayList(mealPlanId);

            MealPlanAssignedIngredientRepository mealPlanAssignedIngredientRepository = new MealPlanAssignedIngredientRepository();

            mealPlanDisplay.MealPlanAssignedIngredients = mealPlanAssignedIngredientRepository.GetDisplayList(mealPlanId);

            MealPlanAssignedDishRepository mealPlanAssignedDishRepository = new MealPlanAssignedDishRepository();

            mealPlanDisplay.MealPlanAssignedDishes = mealPlanAssignedDishRepository.GetDisplayList(mealPlanId);

            UomViewModel uomViewModel = new UomViewModel();

            mealPlanDisplay.UomDropDownList = uomViewModel.GetDropDownList();

            DishViewModel dishViewModel = new DishViewModel();

            mealPlanDisplay.DishDropDownList = dishViewModel.GetDropDownList();

            IngredientViewModel ingredientViewModel = new IngredientViewModel();

            mealPlanDisplay.IngredientDropDownList = ingredientViewModel.GetDropDownList();

            return(mealPlanDisplay);
        }