コード例 #1
0
        public async Task <IActionResult> Create([Bind("UserId,FirstName,LastName,Age,Height,Weight,Email,Password")] Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("FitnessId,UserId,FitnessDate,Weight,Steps,Water,Calories,Floors")] DailyFitness dailyFitness)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dailyFitness);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Email", dailyFitness.UserId);
            return(View(dailyFitness));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("SleepId,UserId,Awake,Light,Deep,Rem,SleepDate")] Sleep sleep)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sleep);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Email", sleep.UserId);
            return(View(sleep));
        }