コード例 #1
0
 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);
     }
 }
コード例 #2
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);
     }
 }
コード例 #3
0
 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);
     }
 }