public async Task <IActionResult> Edit(int id, [Bind("ID,UserID,Number")] Ticket ticket)
        {
            if (id != ticket.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ticket);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TicketExists(ticket.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticket));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Account")] User user, string[] ticketNumbers)
        {
            if (id != user.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    _context.Ticket.RemoveRange(_context.Ticket.Where(ticket => ticket.UserID == user.ID));
                    foreach (string ticketNumber in ticketNumbers.Where(ticketNumber => !string.IsNullOrEmpty(ticketNumber)).ToArray())
                    {
                        _context.Add(new Ticket {
                            UserID = user.ID, Number = int.Parse(ticketNumber)
                        });
                    }
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "Home"));
            }
            return(View(user));
        }