public bool AddDayBook(DayBook model) { try { entities.DayBooks.Add(model); entities.SaveChanges(); return true; } catch (Exception x) { throw x; } }
public bool UpdateDayBook(DayBook model) { try { DayBook daybook = entities.DayBooks.Where(x => x.DayBookId == model.DayBookId).SingleOrDefault(); if (daybook != null) { entities.Entry(daybook).CurrentValues.SetValues(model); entities.SaveChanges(); return true; } else { return false; } } catch (Exception x) { throw x; } }