Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,FirstName,LastName,Age,Height,Weight,Email,Password")] Users users)
        {
            if (id != users.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
        public async Task <IActionResult> Edit(int id, [Bind("FitnessId,UserId,FitnessDate,Weight,Steps,Water,Calories,Floors")] DailyFitness dailyFitness)
        {
            if (id != dailyFitness.FitnessId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dailyFitness);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DailyFitnessExists(dailyFitness.FitnessId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Email", dailyFitness.UserId);
            return(View(dailyFitness));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("SleepId,UserId,Awake,Light,Deep,Rem,SleepDate")] Sleep sleep)
        {
            if (id != sleep.SleepId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sleep);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SleepExists(sleep.SleepId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Email", sleep.UserId);
            return(View(sleep));
        }