Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Email,Password")] Users users)
        {
            if (id != users.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Date,BodyWeight,UserId")] Progress progress)
        {
            if (id != progress.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(progress);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProgressExists(progress.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", progress.UserId);
            return(View(progress));
        }
        public async Task <IActionResult> Edit(string id, [Bind("Id,BodyPart,Exercise,TypeOfWorkout")] Exercises exercises)
        {
            if (id != exercises.Exercise)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exercises);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExercisesExists(exercises.Exercise))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(exercises));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Exercise,NumberOfReps,Weight,WorkoutId")] Sets sets)
        {
            if (id != sets.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sets);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SetsExists(sets.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(UserHome)));
            }
            ViewData["Exercise"]  = new SelectList(_context.Exercises, "Exercise", "Exercise", sets.Exercise);
            ViewData["WorkoutId"] = new SelectList(_context.Workout, "Id", "Id", sets.WorkoutId);
            return(View(sets));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,WorkoutNumber,UserId,Date")] Workout workout)
        {
            if (id != workout.Id)
            {
                return(NotFound());
            }

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