Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,RefNumber,Ssn,RefereeTypeId,RefereeCategoryId,RefereeCategoryTypeId,RefereeDistrictId,ClubId,StreetAddress,ZipCode,County,Country,PhoneNumber1,PhoneNumber2,Email")] TSMRef tSMRef)
        {
            if (id != tSMRef.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tSMRef);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TSMRefExists(tSMRef.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClubId"]                = new SelectList(_context.Set <Club>(), "Id", "ClubName", tSMRef.ClubId);
            ViewData["RefereeCategoryId"]     = new SelectList(_context.Set <RefereeCategory>(), "Id", "RefereeCategoryName", tSMRef.RefereeCategoryId);
            ViewData["RefereeCategoryTypeId"] = new SelectList(_context.Set <RefereeCategoryType>(), "Id", "RefereeCategoryTypeName", tSMRef.RefereeCategoryTypeId);
            ViewData["RefereeDistrictId"]     = new SelectList(_context.Set <RefereeDistrict>(), "Id", "RefereeDistrictName", tSMRef.RefereeDistrictId);
            ViewData["RefereeTypeId"]         = new SelectList(_context.Set <RefereeType>(), "Id", "RefereeTypeName", tSMRef.RefereeTypeId);
            return(View(tSMRef));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,RefNumber,Ssn,RefereeTypeId,RefereeCategoryId,RefereeCategoryTypeId,RefereeDistrictId,ClubId,StreetAddress,ZipCode,County,Country,PhoneNumber1,PhoneNumber2,Email")] TSMRef tSMRef)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tSMRef);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClubId"]                = new SelectList(_context.Set <Club>(), "Id", "ClubName", tSMRef.ClubId);
            ViewData["RefereeCategoryId"]     = new SelectList(_context.Set <RefereeCategory>(), "Id", "RefereeCategoryName", tSMRef.RefereeCategoryId);
            ViewData["RefereeCategoryTypeId"] = new SelectList(_context.Set <RefereeCategoryType>(), "Id", "RefereeCategoryTypeName", tSMRef.RefereeCategoryTypeId);
            ViewData["RefereeDistrictId"]     = new SelectList(_context.Set <RefereeDistrict>(), "Id", "RefereeDistrictName", tSMRef.RefereeDistrictId);
            ViewData["RefereeTypeId"]         = new SelectList(_context.Set <RefereeType>(), "Id", "RefereeTypeName", tSMRef.RefereeTypeId);
            return(View(tSMRef));
        }