コード例 #1
0
 public bool AddManufacturer(manufacturer s)
 {
     try
     {
         using (QLBH_PHONE_ENTITY data = new QLBH_PHONE_ENTITY())
         {
             data.manufacturers.Add(s);
             data.SaveChanges();
             return true;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         return false;
     }
 }
コード例 #2
0
 public bool UpdateManufacturer(manufacturer s)
 {
     try
     {
         using (QLBH_PHONE_ENTITY data = new QLBH_PHONE_ENTITY())
         {
             //Test
             var getItem = data.manufacturers.Single(p => p.id == s.id);
             //data.Entry(s).State = EntityState.Modified;
             getItem = s;
             data.SaveChanges();
             return true;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         return false;
     }
 }