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); }
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); }