public static void AddOrUpdate(SpareEntities db, TA_STORE_WHSE data, TS_OPERATOR oper) { var logType = db.TA_STORE_WHSE.Any(p => p.UID == data.UID) ? LogType.BaseDataModify : LogType.BaseDataCreate; try { db.TA_STORE_WHSE.AddOrUpdate(p => p.WhseCode, 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_WHSE data, TS_OPERATOR oper) { db.Entry(data).State = EntityState.Deleted; OperLogController.AddLog(db, LogType.BaseDataDelete, oper.OperName, data.ToString()); }