예제 #1
0
        public async Task <IActionResult> Create([Bind("ID,LastName,FirstMidName,Email,EnrollmentDate")] Camper camper)
        {
            if (ModelState.IsValid)
            {
                camper.ID = Guid.NewGuid();
                _context.Add(camper);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(camper));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ID,Title,Credits")] Course course)
        {
            if (ModelState.IsValid)
            {
                course.ID = Guid.NewGuid();
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }