public void DisableCalendar(CalendarCalDavInfo calendar) { using (var context = new OwnCloudDataContext()) { var entity = (from o in context.Calendars where o.Url == calendar.Url select o).SingleOrDefault(); if (entity != null) context.Calendars.DeleteOnSubmit(entity); var eventsToDelete = context.Events.Where(o => o.CalendarId == entity.Id).ToArray(); context.Events.DeleteAllOnSubmit(eventsToDelete); context.SubmitChanges(); } }
public void EnableCalendar(CalendarCalDavInfo calendar) { using (var context = new OwnCloudDataContext()) { var existingEntity = (from o in context.Calendars where o.Url == calendar.Url select o).SingleOrDefault(); if (existingEntity != null) return; var entity = TableCalendar.FromCalDavCalendarInfo(calendar); entity.GetCTag = ""; entity._accountId = this._accountId; context.Calendars.InsertOnSubmit(entity); context.SubmitChanges(); } }
public void DisableCalendar(CalendarCalDavInfo calendar) { using (var context = new OwnCloudDataContext()) { var entity = (from o in context.Calendars where o.Url == calendar.Url select o).SingleOrDefault(); if (entity != null) { context.Calendars.DeleteOnSubmit(entity); } var eventsToDelete = context.Events.Where(o => o.CalendarId == entity.Id).ToArray(); context.Events.DeleteAllOnSubmit(eventsToDelete); context.SubmitChanges(); } }
public void EnableCalendar(CalendarCalDavInfo calendar) { using (var context = new OwnCloudDataContext()) { var existingEntity = (from o in context.Calendars where o.Url == calendar.Url select o).SingleOrDefault(); if (existingEntity != null) { return; } var entity = TableCalendar.FromCalDavCalendarInfo(calendar); entity.GetCTag = ""; entity._accountId = this._accountId; context.Calendars.InsertOnSubmit(entity); context.SubmitChanges(); } }