public Code Edit(long userId, Code toEdit) { using (var tran = new TransactionScope()) { Code toRet; if (toEdit.OldCodeName != toEdit.CodeName) { Delete(userId, toEdit.TableName, toEdit.OldCodeName); toRet = Create(userId, toEdit); } else { toRet = _repository.Edit(toEdit); } //Force cash refresh for all module entries CacheHelper.Clear(Module); BlLog.Log(userId, Module, "Edit code", "CodeModified", new object[] { toEdit.CodeName, toEdit.TableName }); tran.Complete(); return(toRet); } }