public async Task <IActionResult> Edit(int id, [Bind("Id,InviteeId,TableType,IsSittingAtTable,EventId,EventOptionId")] AccessibilityRestriction accessibilityRestriction) { accessibilityRestriction.EventId = MyGlobals.GlobalEventID; if (id != accessibilityRestriction.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(accessibilityRestriction); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccessibilityRestrictionExists(accessibilityRestriction.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EventId"] = new SelectList(_context.Event.OrderBy(x => x.Name), "Id", "Name", accessibilityRestriction.EventId); ViewData["InviteeId"] = new SelectList(_context.Invitee.Where(t => t.EventId == MyGlobals.GlobalEventID). OrderBy(x => x.FullName), "Id", "FullName", accessibilityRestriction.InviteeId); return(View(accessibilityRestriction)); }
public async Task <IActionResult> Create([Bind("Id,InviteeId,TableType,IsSittingAtTable,EventId,EventOptionId")] AccessibilityRestriction accessibilityRestriction) { accessibilityRestriction.EventId = MyGlobals.GlobalEventID; if (ModelState.IsValid) { _context.Add(accessibilityRestriction); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EventId"] = new SelectList(_context.Event.OrderBy(x => x.Name), "Id", "Name", accessibilityRestriction.EventId); ViewData["InviteeId"] = new SelectList(_context.Invitee.Where(t => t.EventId == MyGlobals.GlobalEventID). OrderBy(x => x.FullName), "Id", "FullName", accessibilityRestriction.InviteeId); return(View(accessibilityRestriction)); }