// GET: CalorieCounter public ActionResult Index() { CalorieCounterViewModel calorie = new CalorieCounterViewModel(); var userName = User.Identity.GetUserName(); var user = _context.Users.Where(x => x.UserName == userName).First(); var foodList = _context.FoodInput.Where(x => x.UserId == user.Id).ToList(); calorie.User = user; calorie.Foodlist = foodList; return(View(calorie)); }
public IActionResult CalorieCounter() { List <Recipe> recipes = new List <Recipe>() { new Recipe(id, preperationTime, totalCalories, servingsCount, reactions, imageLinks, ingredients, creatorName, description, name, totalFavorites), new Recipe(id2, preperationTime2, totalCalories2, servingsCount2, reactions2, imageLinks2, ingredients2, creatorName2, description2, name2, totalFavorites2), new Recipe(id3, preperationTime3, totalCalories3, servingsCount3, reactions3, imageLinks3, ingredients3, creatorName3, description3, name3, totalFavorites3) }; //fill viewmodel CalorieCounterViewModel calorieCounterVM = new CalorieCounterViewModel(); calorieCounterVM.recipes = recipes; return(View(calorieCounterVM)); }