public void disapproveEvent(int id)
        {
            LocalEvent localEvent = GetEventById(id);

            _context.LocalEvents.Attach(localEvent);
            localEvent.IsApproved = 0;
            _context.SaveChanges();
        }
        public void DeleteMyEvents(string userId)
        {
            IEnumerable <LocalEventsViewModel> myEvents = GetMyEvents(userId, null, null);

            foreach (LocalEventsViewModel localEventViewModel in myEvents)
            {
                LocalEvent localEvent = GetEventById(localEventViewModel.EventId.Value);
                removeEvent(localEvent);
            }
        }
        public void expireEvent(LocalEvent localEvent)
        {
            _context.LocalEvents.Attach(localEvent);

            if (localEvent.Recurring == null)
            {
                localEvent.Expired = 1;
            }
            else
            {
                localEvent.StartDate = localEvent.StartDate.AddDays(localEvent.Recurring.Value);
            }

            _context.SaveChanges();
        }
        public void editEvent(LocalEventsViewModel newEvent)
        {
            LocalEvent oldEvent = GetEventById(newEvent.EventId.Value);

            _context.LocalEvents.Attach(oldEvent);

            oldEvent.LastUpdate       = DateTime.Now;
            oldEvent.EventName        = newEvent.EventName;
            oldEvent.hostedBy         = newEvent.HostedBy;
            oldEvent.Contact          = newEvent.Contact;
            oldEvent.Website          = newEvent.Website;
            oldEvent.StartDate        = newEvent.StartDate;
            oldEvent.Duration         = newEvent.Duration;
            oldEvent.Recurring        = newEvent.Recurring;
            oldEvent.EventDescription = newEvent.EventDescription;
            oldEvent.EventType        = newEvent.EventType;
            oldEvent.EventLocation    = newEvent.EventLocation;
            oldEvent.ImageURL         = newEvent.ImageURL;

            _context.SaveChanges();
        }
 public void removeEvent(LocalEvent e)
 {
     _context.LocalEvents.Remove(e);
     _context.SaveChanges();
 }
 public void addEvent(LocalEvent e)
 {
     _context.LocalEvents.Add(e);
     _context.SaveChanges();
 }