Пример #1
0
        public async Task <IActionResult> Create([Bind("WorkoutLogId,DateTime,ExerciseId")] WorkoutLog workoutLog)
        {
            if (ModelState.IsValid)
            {
                _context.Add(workoutLog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(workoutLog));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("UserId,UserName,InductionCompleted,DateJoined")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("CategoryId,CategoryName")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("ExerciseId,ExerciseName,CategoryId")] Exercis exercis)
        {
            if (ModelState.IsValid)
            {
                _context.Add(exercis);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "CategoryId", "CategoryId", exercis.CategoryId);
            return(View(exercis));
        }