Beispiel #1
0
        public JsonResult SaveEvent(Events e)
        {
            var status = false;

            using (CalendarDataBaseEntities cd = new CalendarDataBaseEntities())
            {
                if (e.EventID > 0)
                {
                    var v = cd.Events.Where(a => a.EventID == e.EventID).FirstOrDefault();
                    if (v != null)
                    {
                        v.Subject     = e.Subject;
                        v.Start       = e.Start;
                        v.End         = e.End;
                        v.Description = e.Description;
                        //v.IsFullDay = e.IsFullDay;
                        v.ThemeColor = e.ThemeColor;
                    }
                }
                else
                {
                    cd.Events.Add(e);
                }
                cd.SaveChanges();
                status = true;
            }

            return(new JsonResult {
                Data = new { status = status }
            });
        }
Beispiel #2
0
        public JsonResult DeleteEvent(int eventID)
        {
            var status = false;

            using (CalendarDataBaseEntities cd = new CalendarDataBaseEntities())
            {
                var v = cd.Events.Where(a => a.EventID == eventID).FirstOrDefault();
                if (v != null)
                {
                    cd.Events.Remove(v);
                    cd.SaveChanges();
                    status = true;
                }
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }