public E.EventRegistration UpdateEventRegistration(E.EventRegistration eventRegistration)
 {
     Contract.Requires(eventRegistration != null);
     using (IUnitOfWork uow = this.GetUnitOfWork())
     {
         IRepository <E.EventRegistration> repo = uow.GetRepository <E.EventRegistration>();
         repo.Put(eventRegistration);
         uow.Commit();
     }
     return(eventRegistration);
 }
        /// <summary>
        /// If the <paramref name="Activity"/> is not associated to any <see cref="Event"/>, the method deletes it from the database.
        /// </summary>
        public bool DeleteEventRegistration(E.EventRegistration eventRegistration)
        {
            Contract.Requires(eventRegistration != null);
            Contract.Requires(eventRegistration.Id >= 0);

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <E.EventRegistration> repo = uow.GetRepository <E.EventRegistration>();
                eventRegistration = repo.Reload(eventRegistration);
                repo.Delete(eventRegistration);
                uow.Commit();
            }

            return(true);
        }
        /// <summary>
        /// Creates an EventRegistration <seealso cref="EventRegistration"/> and persists the entity in the database.
        /// </summary>
        public E.EventRegistration CreateEventRegistration(XmlDocument data, E.Event e, User user, bool deleted, string token)
        {
            E.EventRegistration eventRegistration = new E.EventRegistration();
            eventRegistration.Data    = data;
            eventRegistration.Deleted = deleted;
            eventRegistration.Event   = e;
            eventRegistration.Person  = user;
            eventRegistration.Token   = token;

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository <E.EventRegistration> repo = uow.GetRepository <E.EventRegistration>();
                repo.Put(eventRegistration);
                uow.Commit();
            }

            return(eventRegistration);
        }