//for a meal entered directly by the user
        public AddMealViewModel(
            string userId,
            IEnumerable <WeatherType> weatherType,
            IEnumerable <CookingMethod> cookingMethod,
            IEnumerable <CookingMethod> altCookingMethod,
            IEnumerable <CookingTime> cookingTime,
            IEnumerable <PrepTime> prepTime)
        {
            // include user id as foreign key to link meals with user
            UserID = userId;

            // create Weather Type list
            WeatherTypes = new List <SelectListItem>();
            WeatherTypes = PopulateViewList.AddViewModelList(weatherType);

            // create Cooking Method list
            CookingMethods = new List <SelectListItem>();
            CookingMethods = PopulateViewList.AddViewModelList(cookingMethod);

            // create Alternate Cooking Method list
            AltCookingMethods = new List <SelectListItem>();
            AltCookingMethods = PopulateViewList.AddViewModelList(altCookingMethod);

            // create Cooking Time list
            CookingTimes = new List <SelectListItem>();
            CookingTimes = PopulateViewList.AddViewModelList(cookingTime);

            // create Prep Time list
            PrepTimes = new List <SelectListItem>();
            PrepTimes = PopulateViewList.AddViewModelList(prepTime);
        }
        public AddDefaultMealViewModel(
            IEnumerable <WeatherType> weatherType,
            IEnumerable <CookingMethod> cookingMethod,
            IEnumerable <CookingMethod> altCookingMethod,
            IEnumerable <CookingTime> cookingTime,
            IEnumerable <PrepTime> prepTime)
        {
            // create Weather Type list
            WeatherTypes = new List <SelectListItem>();
            WeatherTypes = PopulateViewList.AddViewModelList(weatherType);

            // create Cooking Method list
            CookingMethods = new List <SelectListItem>();
            CookingMethods = PopulateViewList.AddViewModelList(cookingMethod);

            // create Alternate Cooking Method list
            AltCookingMethods = new List <SelectListItem>();
            AltCookingMethods = PopulateViewList.AddViewModelList(altCookingMethod);

            // create Cooking Time list
            CookingTimes = new List <SelectListItem>();
            CookingTimes = PopulateViewList.AddViewModelList(cookingTime);

            // create Prep Time list
            PrepTimes = new List <SelectListItem>();
            PrepTimes = PopulateViewList.AddViewModelList(prepTime);
        }
Example #3
0
        //Create a new Menu
        public AddMenuViewModel(
            string userId,
            int mealCount,
            IEnumerable <WeatherType> weatherType)
        {
            // include user id as foreign key to link meals with user
            UserID    = userId;
            MealCount = mealCount;

            // create Weather Type list
            WeatherTypes = new List <SelectListItem>();
            WeatherTypes = PopulateViewList.AddViewModelList(weatherType);
        }
        public EditMealViewModel(
            int MealID,
            string MealName,
            string MealDescription,
            string MealUserID,
            IEnumerable <WeatherType> weatherType,
            int WeatherTypeID,
            IEnumerable <CookingMethod> cookingMethod,
            int CookingMethodID,
            IEnumerable <CookingMethod> altCookingMethod,
            int AltCookingMethodID,
            IEnumerable <CookingTime> cookingTime,
            int CookingTimeID,
            IEnumerable <PrepTime> prepTime,
            int PrepTimeID)
        {
            mealID      = MealID;
            Name        = MealName;
            Description = MealDescription;
            UserID      = MealUserID;

            // create Weather Type list
            WeatherTypes = new List <SelectListItem>();
            WeatherTypes = PopulateViewList.EditViewModelList(weatherType, WeatherTypeID);

            // create Cooking Method list
            CookingMethods = new List <SelectListItem>();
            CookingMethods = PopulateViewList.EditViewModelList(cookingMethod, CookingMethodID);

            // create Alternate Cooking Method list
            AltCookingMethods = new List <SelectListItem>();
            AltCookingMethods = PopulateViewList.EditViewModelList(altCookingMethod, AltCookingMethodID);

            // create Cooking Time list
            CookingTimes = new List <SelectListItem>();
            CookingTimes = PopulateViewList.EditViewModelList(cookingTime, CookingTimeID);

            // create Prep Time list
            PrepTimes = new List <SelectListItem>();
            PrepTimes = PopulateViewList.EditViewModelList(prepTime, PrepTimeID);
        }