コード例 #1
0
 public tblCalendar SaveEvent(tblCalendar calendarEvent)
 {
     try
     {
         BusProjectEntities db = new BusProjectEntities();
         db.tblCalendars.Add(calendarEvent);
         db.SaveChanges();
         return(calendarEvent);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     return(null);
 }
コード例 #2
0
        public bool Update(tblCalendar calendarEvent)
        {
            var res = false;

            try
            {
                BusProjectEntities db = new BusProjectEntities();
                db.Entry(calendarEvent).State = EntityState.Modified;
                db.SaveChanges();
                res = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(res);
        }