Пример #1
0
        public JsonResult SaveMeeting(Meeting m)
        {
            var status = false;

            using (MeetingsEntities dc = new MeetingsEntities())
            {
                if (m.MeetingID > 0)
                {
                    //aktualizowanie spotkania
                    var v = dc.Meetings.Where(a => a.MeetingID == m.MeetingID).FirstOrDefault();
                    if (v != null)
                    {
                        v.ClientName  = m.ClientName;
                        v.MeetingType = m.MeetingType;
                        v.Start       = m.Start;
                        v.End         = m.End;
                        v.ThemeColor  = v.ThemeColor;
                        v.IsFullDay   = m.IsFullDay;
                    }
                }
                else
                {
                    dc.Meetings.Add(m);
                }
                dc.SaveChanges();
                status = true;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
Пример #2
0
        public JsonResult DeleteMeeting(int meetingID)
        {
            var status = false;

            using (MeetingsEntities dc = new MeetingsEntities())
            {
                var v = dc.Meetings.Where(a => a.MeetingID == meetingID).FirstOrDefault();
                if (v != null)
                {
                    dc.Meetings.Remove(v);
                    dc.SaveChanges();
                    status = true;
                }
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }