Esempio n. 1
0
        public static void UpdateEvent(string calendarName, CalendarEvent oEvent)
        {
            int currentCalendarId = CalendarId(calendarName);

            DnDSignUpEntities entities = new DnDSignUpEntities();

            // MLW TODO first name change
            Event e = entities.Events.Single(x => x.CalendarId == currentCalendarId && x.EventId == oEvent.ID);
            if (e != null)
            {
                e.EventId = oEvent.ID;
                e.Title = oEvent.Title;
                e.AllDay = oEvent.IsAllDay;
                e.CalendarId = currentCalendarId;
                e.StartTime = oEvent.StartDateTime;
                e.EndTime = oEvent.EndDateTime;
                e.Status = oEvent.Status;
                e.OwnerId = oEvent.OwnerId;

                DbEntityEntry entry = entities.Entry(e);
                entry.State = EntityState.Modified;
                entities.SaveChanges();
            }
        }
Esempio n. 2
0
        public ActionResult UpdateEventStatus(string calendarName, string id, int status, long ownerId)
        {
            SMap.GetLogger().Application("UpdateEventStatus: Calendar=" + calendarName + "; Event=" + id + "; Status=" + status + "; SpouseId=" + ownerId);

            if (!BusinessLogic.IsThisTheSpouseOfTheCurrentUser(ownerId, User)) return null;

            Event existingEvent = DBRepository.GetEvent(calendarName, id);

            CalendarEvent calEvent = new CalendarEvent(existingEvent.Title, existingEvent.EventId, status,
                                                       existingEvent.StartTime, existingEvent.EndTime,
                                                       existingEvent.AllDay, existingEvent.OwnerId);

            DBRepository.UpdateEvent(calendarName, calEvent);
            return null;
            //}
            //else
            //    return Content("Not your event. Won't stick.");
        }