コード例 #1
0
        public async Task <IActionResult> Create([Bind("FirstName,LastName,JobRole,Id")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Description,Id")] EventType eventType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(eventType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(eventType));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Name,Address,Id")] School school)
        {
            if (ModelState.IsValid)
            {
                _context.Add(school);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(school));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("EventName,SchoolID,Place,Id")] Event @event)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@event);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(@event));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("FirstName,LastName,DoB,Id")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("CompetitionType,LocationName,StartDate,FinishDate,Id")] Competition competition)
        {
            if (ModelState.IsValid)
            {
                _context.Add(competition);
                await _context.SaveChangesAsync();

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