public ActionResult AddMeeting(MeetingModel model) { NameMeetingEvent meeting = new NameMeetingEvent { NameEvent = model.NameEvent }; _context.MeetingEvents.Add(meeting); _context.SaveChanges(); int a = _context.MeetingEvents.Count(); if (model.HeaderEvent.Count() > 0 && model.NameEvent.Count() > 0) { for (int i = 0; i < model.HeaderEvent.Count; i++) { MeetingInformation information = new MeetingInformation { MeetingID = _context.MeetingEvents.Count(), Header = model.HeaderEvent[i], Context = model.ContextEvent[i] }; _context.MeetingInformations.Add(information); _context.SaveChanges(); } } return(RedirectToAction("GetAllMeeting")); }
public IActionResult GetInfoAboutMeeting(int?EventId) { NameMeetingEvent SelectedMeeting = _context.MeetingEvents.Single(p => p.Id == EventId); List <MeetingInformation> SelectedMeetingInfo = new List <MeetingInformation>(); foreach (var element in _context.MeetingInformations) { if (element.MeetingID == SelectedMeeting.Id) { SelectedMeetingInfo.Add(element); } } ViewBag.EventId = EventId; //I'm sorry for ViewBag :( return(View(SelectedMeetingInfo)); }