public virtual EventItem CopyItem(EventItem item)
 {
     Id = item.Id;
     Description = item.Description;
     Titel = item.Titel;
     Start = item.Start;
     End = item.End;
     return this;
 }
        public void StartItem(string aTitel)
        {
            int id = (items.Count>0)?items.Max(f => f.Id):0;

            EventItem newItem = new EventItem();
            newItem.Titel = aTitel;
            newItem.Id = ++id;

            pendingItems.Add(newItem);
            items.Add(newItem);
        }
        public void EditItem(EventItem changeItem)
        {
            EventItem item = FindItem(changeItem.Id);

            if(DateTime.Compare(changeItem.Start,changeItem.End) < 0)
                throw new InvalidOperationException(string.Format("Event start {0} can not be after event end {1}",changeItem.Start, changeItem.End));
            
            item.Start = changeItem.Start;
            item.End = changeItem.End;
            item.Description = changeItem.Description;
            item.Titel = changeItem.Titel;
        }
 public ActionResult Edit(EventItem item)
 {
     if(ModelState.IsValid)
     {
         try
         {
             eventManager.EditItem(item);
         }
         catch(Exception e)
         {
             ModelState.AddModelError("Error",e.Message);
         }
     }
     return RedirectToAction(this.CurrentView,item);
 }
 public ActionResult StartEvent()
 {
     EventItem item = new EventItem();
     return PartialView("_StartEvent", item);
 }
 public ActionResult StartEvent(EventItem startItem)
 {
     return Start(startItem.Titel);
 }
 public virtual bool Equals(EventItem other)
 {
     if(other == null) return false;
     return (Id == other.Id);
 }
 public EventItem(EventItem item)
 {
     CopyItem(item);
 }
        public override EventItem CopyItem(EventItem item)
        {
            base.CopyItem(item);
            TypedEventItem typeItem = item as TypedEventItem;
            if(typeItem != null)
                Type = typeItem.Type;

            return this;
        }
 public TypedEventItem(EventItem item)
 {
     CopyItem(item);
 }