public int UpdateEquipmentUsageHistory(EquipmentUsageHistory equipmentUsageHistory) { try { if (equipmentUsageHistory == null) { return(-2); } using (var db = new DPRDataMigrationEngineDBEntities()) { db.EquipmentUsageHistories.Attach(equipmentUsageHistory); db.Entry(equipmentUsageHistory).State = EntityState.Modified; return(db.SaveChanges()); } } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public int AddEquipmentUsageHistory(EquipmentUsageHistory equipmentUsageHistory) { try { if (equipmentUsageHistory == null) { return(-2); } using (var db = new DPRDataMigrationEngineDBEntities()) { var processedItem = db.EquipmentUsageHistories.Add(equipmentUsageHistory); db.SaveChanges(); return(processedItem.EquipmentUsageHistoryId); } } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); return(0); } }