Exemple #1
0
 public int Create(RPT_Company data)
 {
     using (ReportEntities db = new ReportEntities())
     {
         db.RPT_Company.Add(data);
         return(db.SaveChanges());
     }
 }
Exemple #2
0
 public int Update(RPT_Company data)
 {
     using (ReportEntities db = new ReportEntities())
     {
         var exsit = db.RPT_Company.FirstOrDefault(p => p.CompanyCode == data.CompanyCode);
         if (exsit != null)
         {
             int id = exsit.ID;
             exsit.CopyFrom(data);
             exsit.ID = id;
         }
         return(db.SaveChanges());
     }
 }