예제 #1
0
        public async Task <IActionResult> Create([Bind("ID,Name")] DailyNutrition dailyNutrition)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dailyNutrition);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(dailyNutrition));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,ServingSize,ServingSizeType,Calories,Protein,Fat,Carbs")] Food food)
        {
            if (ModelState.IsValid)
            {
                _context.Add(food);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(food));
        }