public ActionResult Create(EventForm eventForm)
 {
     if (Request.IsAjaxRequest())
     {
         var @event = new Event()
                          {
                              Description = eventForm.Description,
                              Name = eventForm.Name
                          };
         Timeline timeline = _timelineRepository.FindById(eventForm.TimelineId);
         timeline.AddEvent(@event);
         _timelineRepository.Save(timeline);
         var eventViewModels = timeline.Events.Select(evt => new EventForm.EventViewModel
         {
             Id = evt.Id ?? 0,
             Name = evt.Name
         });
         return PartialView("EventList", eventViewModels);
     }
     return RedirectToAction("Index");
 }
Esempio n. 2
0
 public virtual Event AddEvent(Event @event)
 {
     @event.Timeline = this;
     Events.Add(@event);
     return @event;
 }