예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,UserId,name,mrrId")] MeetingPresence meetingPresence)
        {
            if (id != meetingPresence.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meetingPresence);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingPresenceExists(meetingPresence.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", meetingPresence.UserId);
            ViewData["mrrId"]  = new SelectList(_context.Set <MeetingRoomReservation>(), "ID", "objective", meetingPresence.mrrId);
            return(View(meetingPresence));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ID,UserId,name,mrrId")] MeetingPresence meetingPresence)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meetingPresence);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", meetingPresence.UserId);
            ViewData["mrrId"]  = new SelectList(_context.Set <MeetingRoomReservation>(), "ID", "objective", meetingPresence.mrrId);
            return(View(meetingPresence));
        }