public bool Save(EventFormViewModel viewModel)
        {
            var eventRepository = new EventRepository();

            var mnfEvent = new MNFEvent
            {
                ID          = viewModel.ID,
                Name        = viewModel.Name,
                EventTypeID = viewModel.EventTypeID,
                Cost        = viewModel.Cost,
                Description = viewModel.Description,
                EventDate   = DateTime.Parse(viewModel.EventDate),
                // store following starttime/endtime WITH the date to convert to ISO 8601 on display page
                StartTime   = DateTime.Parse(viewModel.EventDate).Add(DateTime.Parse(viewModel.StartTime).TimeOfDay),
                EndTime     = DateTime.Parse(viewModel.EventDate).Add(DateTime.Parse(viewModel.EndTime).TimeOfDay),
                Location    = viewModel.Location,
                ShowEvent   = viewModel.ShowEvent,
                EventMarkup = viewModel.EventMarkup
            };

            try
            {
                eventRepository.InsertOrUpdate(mnfEvent);   // handles new or edit record based on ID
                eventRepository.Save();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public void InsertOrUpdate(MNFEvent mnfEvent)
 {
     if (mnfEvent.ID == 0)
     {
         // new Event record
         _db.MNFEvents.Add(mnfEvent);
     }
     else
     {
         // update existing record
         _db.Entry(mnfEvent).State = EntityState.Modified;
     }
 }