Example #1
0
 public static Boolean DeleteEvent(int eventID)
 {
     try
     {
         ApplicationDbContext ent = new ApplicationDbContext();
         CalendarItem         ev  = ent.CalendarItems.Find(eventID);
         ent.CalendarItems.Remove(ev);
         ent.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #2
0
 public static Boolean EditEvent(int eventID, String evDate, String evAction)
 {
     try
     {
         ApplicationDbContext ent = new ApplicationDbContext();
         CalendarItem         ev  = ent.CalendarItems.Find(eventID);
         ev.EventDate   = DateTime.ParseExact(evDate, "dd-MMM-yyyy", CultureInfo.InvariantCulture);
         ev.EventAction = evAction;
         ent.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #3
0
        public static Boolean AddEvent(String evDate, String evAction)
        {
            CalendarItem ev = new CalendarItem();

            try
            {
                ev.EventDate   = DateTime.ParseExact(evDate, "dd-MMM-yyyy", CultureInfo.InvariantCulture);
                ev.EventAction = evAction;
                ApplicationDbContext ent = new ApplicationDbContext();
                ent.CalendarItems.Add(ev);
                ent.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }