public ActionResult CreateMeal(MealRecipeViewModel model) { if (model != null && model.MealType != null) { int userId = (int)Session[SessionKeys.UserId]; List <int> recipeIds = new List <int>(); List <string> mealTypes = new List <string>(); foreach (var mt in model.MealType) { //List<string> recipeMeal = recipeMealType.Split(',').ToList(); //recipeIds.Add(Convert.ToInt32(recipeMeal[0])); mealTypes.Add(mt); } Meal meal = new Meal() { MealName = model.MealName, RecipeIds = model.RecipeIds, MealTypes = mealTypes, RecipeNames = model.RecipeNames }; mealDAL.SaveMeal(meal, userId); if (userDAL.GetUser((string)Session[SessionKeys.EmailAddress]) != null) { return(RedirectToAction("Detail", "Meal", new { mealId = meal.MealId })); } } return(RedirectToAction("Login", "User")); }