public static void UpdateDataBaseCalendarEventTime(SiteCalenderApiController.CalendarEvents calendarEvent)
 {
     var dataModel = new DesignEntities();
     var item = (from p in dataModel.CalendarEvents where p.CalendarEventId == calendarEvent.CalendarEventId select p).FirstOrDefault();
     if (item != null)
     {
         item.StartDate = calendarEvent.StartDate;
         item.EndDate = calendarEvent.EndDate < calendarEvent.StartDate ? calendarEvent.StartDate.AddHours(1) :calendarEvent.EndDate;
     }
     dataModel.SaveChanges();
 }
 public static CalendarEvent InsertCalendarEvent(SiteCalenderApiController.CalendarEvents calendarEvent)
 {
     var dataModel = new DesignEntities();
     var item = new CalendarEvent
     {
         CalendarEventTypeId = calendarEvent.CalendarEventTypeId,
         Title = calendarEvent.Title,
         Description = calendarEvent.Description,
         StartDate = calendarEvent.StartDate,
         EndDate = calendarEvent.EndDate,
         Editable = calendarEvent.Editable
     };
     dataModel.CalendarEvents.Add(item);
     dataModel.SaveChanges();
     return item;
 }