예제 #1
0
 public ActionResult Create()
 {
     EventCreateViewModel eventCreateViewModel = new EventCreateViewModel();
     eventCreateViewModel.Event = new Event();
     eventCreateViewModel.technologies = DataAccess.Technology.GetTechnologiesList();
     eventCreateViewModel.speakers = DataAccess.AspNetUsers.GetUsersList();
     return View(eventCreateViewModel);
 }
예제 #2
0
 public ActionResult Create(Event @event, long[] technologies, string[] speakers)
 {
     if (technologies == null)
         technologies = new long[] { };
     if (speakers == null)
         speakers = new string[] { };
     if (ModelState.IsValid)
     {
         @event.Technology = db.Technology.Where(t => technologies.Contains(t.id)).ToList();
         db.Event.Add(@event);
         db.SaveChanges();
         @event.Event_AspNetUsers = speakers.Select(s => new Event_AspNetUsers { user_id = s, event_id = @event.id, type = "speaker" }).ToList();
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     EventCreateViewModel eventCreateViewModel = new EventCreateViewModel();
     eventCreateViewModel.Event = @event;
     eventCreateViewModel.technologies = DataAccess.Technology.GetTechnologiesList();
     eventCreateViewModel.speakers = DataAccess.AspNetUsers.GetUsersList();
     return View(eventCreateViewModel);
 }