Пример #1
0
        public async Task <IActionResult> Create([Bind("Id,DistrictName")] District district)
        {
            if (ModelState.IsValid)
            {
                _context.Add(district);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(district));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,AgeGroupName")] AgeGroup ageGroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ageGroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ageGroup));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,TeamName")] Team team)
        {
            if (ModelState.IsValid)
            {
                _context.Add(team);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,StreetAddress,ZipCode,County,Country,Ssn,PhoneNumber1,PhoneNumber2,Email,ClubId,SportId,DistrictId,AgeGroupId,TeamId,SeasonId")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AgeGroupId"] = new SelectList(_context.AgeGroup, "Id", "AgeGroupName", person.AgeGroupId);
            ViewData["ClubId"]     = new SelectList(_context.Club, "Id", "ClubName", person.ClubId);
            ViewData["DistrictId"] = new SelectList(_context.District, "Id", "DistrictName", person.DistrictId);
            ViewData["SeasonId"]   = new SelectList(_context.Set <Season>(), "Id", "SeasonName", person.SeasonId);
            ViewData["SportId"]    = new SelectList(_context.Sport, "Id", "SportName", person.SportId);
            ViewData["TeamId"]     = new SelectList(_context.Team, "Id", "TeamName", person.TeamId);
            return(View(person));
        }