// GET: Registration/RegisterAttendee
        public ActionResult RegisterAttendee()
        {
            var registerAttendeesViewModel = new RegisterAttendeeViewModel();

            PopulateClients(registerAttendeesViewModel);
            return View(registerAttendeesViewModel);
        }
        public ActionResult RegisterAttendee(RegisterAttendeeViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var attendee = new Attendee();
                attendee.ClientId = Int32.Parse(viewModel.SelectedClient);
                attendee.Name = viewModel.Name;
                attendee.Email = viewModel.Email;

                db.Attendees.Add(attendee);
                db.SaveChanges();

                return RedirectToAction("Index", "Home");
            }

            PopulateClients(viewModel);
            return View(viewModel);
        }
        private void PopulateClients(RegisterAttendeeViewModel registerAttendeesViewModel)
        {
            var clientList = db.Clients.ToList();

            registerAttendeesViewModel.Clients = clientList.Select(c => new SelectListItem() { Text = c.Name, Value = c.Id.ToString() });
        }