public Result UpdateUnits(UserUnits model) { ApiResultEnum result = UnitDA.UpdateUserID(model); if (result == ApiResultEnum.Success && MonitorRA.GetStatusTrade() != 0) { string[] keys = TradeRA.KeySearch("U_*"); foreach (string key in keys) { string _user_id = TradeRA.Get(key, "user_id"); if (model.unit_ids.Contains(int.Parse(key.Substring(2)))) { if (model.id != _user_id) { UnitRA.UpdateUserID(model.id, key); } } else { if (model.id == _user_id) { UnitRA.UpdateUserID("0", key); } } } } return(Result(result)); }