public Event Update(Event @event)
 {
     using (var txn = session.BeginTransaction())
     {
         var savedEvent = SaveOrUpdate(@event, txn);
         txn.Commit();
         return savedEvent;
     }
 }
        public void SetUp()
        {
            testDataHelper = new TestDataHelper();

            jamesFranklin = ConstituentMother.ConstituentWithName(ConstituentNameMother.JamesFranklin());
            savedConstituent = testDataHelper.CreateConstituent(jamesFranklin);

            savedEvent = testDataHelper.CreateEvent(EventMother.Anniversary());
            eventRepository = new EventRepository();
        }
        public static EventData Anniversary(Event @event)
        {
            return new EventData
            {
                Type = new EventTypeData { Description = "Anniversary", Id = 1 },
                EventTitle = @event.EventTitle,
                EventDescription = @event.EventDescription,
                StartDate = @event.StartDate,
                EndDate = @event.EndDate,
                ContactPerson = @event.ContactPerson,
                ContactNumber = @event.ContactNumber,
                CreatedBy = @event.CreatedBy,
                IsApproved = @event.IsApproved

            };
        }
 public Event UpdateEvent(Event @event)
 {
     LoadEventType(@event);
     return repository.Update(@event);
 }
 public Event CreateEvent(Event @event)
 {
     LoadEventType(@event);
     return repository.Save(@event);
 }
        private void LoadEventType(Event @event)
        {
            if (Entity.IsNull(@event.Type))
            {
                throw new BadRequestException("EventType can not be null");
            }

            @event.Type = repository.Load<EventType>(@event.Type.Id);
        }