public void AddAttendee(Attendee attendee) { if (!attendees.Any(attendee.Equals)) { attendees.Add(attendee); } }
public ActionResult Add(AttendeeFormModel attendeeFormModel) { if (ModelState.IsValid) { var presentation = presentations.FindOne(p => p.Id == attendeeFormModel.presentationId); var attendee = new Attendee { Name = attendeeFormModel.Name, Email = attendeeFormModel.Email, Password = attendeeFormModel.Password, Speaker = attendeeFormModel.Speaker }; presentation.AddAttendee(attendee); presentations.Update(presentation); return RedirectToAction("Details", "Presentations", new { id = presentation.Id }); } return View(attendeeFormModel); }