public async Task <IActionResult> Edit(int id, [Bind("Id,MainInviteeId,SecondaryInviteeId,IsSittingTogether,EventId,EventOptionId")] PersonalRestriction personalRestriction)
        {
            personalRestriction.EventId = MyGlobals.GlobalEventID;
            if (id != personalRestriction.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(personalRestriction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonalRestrictionExists(personalRestriction.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EventId"]            = new SelectList(_context.Event, "Id", "Name", personalRestriction.EventId);
            ViewData["MainInviteeId"]      = new SelectList(_context.Invitee.OrderBy(x => x.FullName), "Id", "FullName", personalRestriction.MainInviteeId);
            ViewData["SecondaryInviteeId"] = new SelectList(_context.Invitee.OrderBy(x => x.FullName), "Id", "FullName", personalRestriction.SecondaryInviteeId);
            return(View(personalRestriction));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CapacityOfPeople,MinCapacityOfPeople,TableType,EventId")] Table table)
        {
            table.EventId = MyGlobals.GlobalEventID;
            if (id != table.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(table);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TableExists(table.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EventId"] = new SelectList(_context.Event.OrderBy(x => x.Name), "Id", "Name", table.EventId);
            return(View(table));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,EventId")] Category category)
        {
            category.EventId = MyGlobals.GlobalEventID;
            if (id != category.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(category);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CategoryExists(category.Name))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Invitees"));
            }
            ViewData["EventId"] = new SelectList(_context.Event.OrderBy(x => x.Name), "Id", "Name", category.EventId);
            return(View(category));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Date")] Event @event)
        {
            if (id != @event.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@event);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventExists(@event.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(@event));
        }
示例#5
0
        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));
        }
示例#6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,InviteeId,TableId,EventOptionId,EventId")] InviteeTable inviteeTable)
        {
            inviteeTable.EventId = MyGlobals.GlobalEventID;
            if (id != inviteeTable.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(inviteeTable);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InviteeTableExists(inviteeTable.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EventId"]       = new SelectList(_context.Event.OrderBy(x => x.Name), "Id", "Name", inviteeTable.EventId);
            ViewData["EventOptionId"] = new SelectList(_context.EventOption, "Id", "Id", inviteeTable.EventOptionId);
            ViewData["InviteeId"]     = new SelectList(_context.Invitee.OrderBy(x => x.FullName), "Id", "FullName", inviteeTable.InviteeId);
            ViewData["TableId"]       = new SelectList(_context.Table, "Id", "Id", inviteeTable.TableId);
            return(View(inviteeTable));
        }
示例#7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,EventId,isFavorite")] EventOption eventOption)
        {
            if (id != eventOption.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eventOption);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EventOptionExists(eventOption.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EventId"] = new SelectList(_context.Event, "Id", "Name", eventOption.EventId);
            return(View(eventOption));
        }
示例#8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,PhoneNumber,Address,IsComing,Comment,EventId,CategoryId")] Invitee invitee)
        {
            invitee.EventId = MyGlobals.GlobalEventID;
            if (id != invitee.Id)
            {
                return(NotFound());
            }

            //foreach(Invitee e in _context.Invitee.ToList())
            //{
            //    if (e.Id != invitee.Id)
            //    {
            //        //e.IsComing = true;
            //        _context.Update(e);
            //        await _context.SaveChangesAsync();
            //    }

            //}

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(invitee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InviteeExists(invitee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"]   = new SelectList(_context.Category.OrderBy(x => x.Name), "Id", "Name", invitee.CategoryId);
            ViewData["EventId"]      = new SelectList(_context.Event.OrderBy(x => x.Name), "Id", "Name", invitee.EventId);
            ViewData["CurrentEvent"] = MyGlobals.GlobalEventName;
            return(View(invitee));
        }