示例#1
0
        public async Task <IActionResult> Create(int dietid, ViewDietMealModel model)
        {
            if (ModelState.IsValid)
            {
                var tesVal = TempData["TestVal"];
                var meal   = new Meal()
                {
                    Name = model.Name
                };
                try {
                    await _context.AddMealAsync(meal, dietid, model);

                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Details", new { id = meal.Id, dietid = dietid }));
                }
                catch (Exception e)
                {
                }
            }
            return(View(model));
        }