private static Exhibitor projectExhibitor(oxite_Conferences_Exhibitor e)
 {
     return(new Exhibitor(
                e.ExhibitorID,
                e.EventID,
                e.Name,
                e.Description,
                e.SiteUrl,
                e.LogoUrl,
                e.ParticipantLevel,
                e.ContactName,
                e.ContactEmail,
                e.Location,
                e.Tags,
                e.CreatedDate,
                e.ModifiedDate));
 }
        public void RemoveExhibitor(EventAddress eventAddress, Exhibitor exhibitor)
        {
            oxite_Conferences_Exhibitor exhibitorToRemove = null;

            if (exhibitor.ID != Guid.Empty)
            {
                exhibitorToRemove = context
                                    .oxite_Conferences_Exhibitors
                                    .FirstOrDefault(c => c.ExhibitorID == exhibitor.ID);
            }

            if (exhibitorToRemove == null)
            {
                return;
            }

            context.oxite_Conferences_Exhibitors.DeleteOnSubmit(exhibitorToRemove);
            context.SubmitChanges();
        }
        public Exhibitor SaveExhibitor(EventAddress eventAddress, Exhibitor exhibitor)
        {
            oxite_Conferences_Exhibitor exhibitorToSave = null;

            if (exhibitor.ID != Guid.Empty)
            {
                exhibitorToSave = context
                                  .oxite_Conferences_Exhibitors
                                  .FirstOrDefault(c => c.ExhibitorID == exhibitor.ID);
            }

            if (exhibitorToSave == null)
            {
                exhibitorToSave = new oxite_Conferences_Exhibitor
                {
                    EventID          = exhibitor.EventID,
                    Name             = exhibitor.Name,
                    ParticipantLevel = "Exhibitor",
                    CreatedDate      = DateTime.UtcNow,
                    ModifiedDate     = DateTime.UtcNow
                };

                context.oxite_Conferences_Exhibitors.InsertOnSubmit(exhibitorToSave);
            }
            else
            {
                exhibitorToSave.ModifiedDate = DateTime.UtcNow;
            }

            exhibitorToSave.Name             = exhibitor.Name;
            exhibitorToSave.Description      = exhibitor.Description;
            exhibitorToSave.SiteUrl          = exhibitor.SiteUrl;
            exhibitorToSave.LogoUrl          = exhibitor.LogoUrl;
            exhibitorToSave.ParticipantLevel = exhibitor.ParticipantLevel;
            exhibitorToSave.ContactName      = exhibitor.ContactName;
            exhibitorToSave.ContactEmail     = exhibitor.ContactEmail;

            context.SubmitChanges();

            return(projectExhibitor(exhibitorToSave));
        }