示例#1
0
        public JsonResult SaveEvent(CALENDAR e)
        {
            var status = false;

            using (cyjEntities dc = new cyjEntities())
            {
                if (e.EventID > 0)
                {
                    //Update the event
                    var v = dc.CALENDARs.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
                {
                    dc.CALENDARs.Add(e);
                }
                dc.SaveChanges();
                status = true;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
示例#2
0
        public JsonResult SaveEvent(CALENDAR e)
        {
            var status = false;

            using (cyjdatabaseEntities dc = new cyjdatabaseEntities())
            {
                if (e.eventID > 0)
                {
                    //Update the event
                    var v = dc.CALENDARs.Where(a => a.eventID == e.eventID).FirstOrDefault();
                    if (v != null)
                    {
                        v.eventHeader      = e.eventHeader;
                        v.eventStart       = e.eventStart;
                        v.eventEnd         = e.eventEnd;
                        v.eventDescription = e.eventDescription;
                    }
                }
                else
                {
                    dc.CALENDARs.Add(e);
                }
                dc.SaveChanges();
                status = true;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }