public static void AddOrUpdate(SpareEntities db, TA_STORE_GROUP data, TS_OPERATOR oper) { var logType = db.TA_STORE_GROUP.Any(p => p.UID == data.UID) ? LogType.BaseDataModify : LogType.BaseDataCreate; try { db.TA_STORE_GROUP.AddOrUpdate(p => p.GroupCode, data); OperLogController.AddLog(db, logType, oper.OperName, data.ToString()); } catch (DbEntityValidationException dbEx) { Console.WriteLine(dbEx.ToString()); throw; } }
public static void Delete(SpareEntities db, TA_STORE_GROUP data, TS_OPERATOR oper) { db.Entry(data).State = EntityState.Deleted; OperLogController.AddLog(db, LogType.BaseDataDelete, oper.OperName, data.ToString()); }