public int createCorrespondence(CORRESPONDENCE_OUT c) { try { m_context.CORRESPONDENCE_OUT.Add(c); m_context.SaveChanges(); return(c.ID); } catch (Exception ex) { //logging return(0); } }
public bool deleteCorrespondence(int id) { try { var c = new CORRESPONDENCE_OUT { ID = id }; m_context.CORRESPONDENCE_OUT.Attach(c); m_context.CORRESPONDENCE_OUT.Remove(c); m_context.SaveChanges(); return(true); } catch (Exception) { //logging; return(false); } }
public int updateCorrespondence(CORRESPONDENCE_OUT c) { try { var original = m_context.CORRESPONDENCE_OUT.Find(c.ID); if (original != null) { m_context.Entry(original).CurrentValues.SetValues(c); m_context.SaveChanges(); return(c.ID); } return(0); } catch (Exception) { return(0); } }