public IPlanshetViewData Initial(IDbConnection connection, AllianceUserDataModel currentAllianceUser, IGameUserService profileService) { var userId = currentAllianceUser.UserId; var allianceId = currentAllianceUser.AllianceId; var allianses = GetAlliancesByRating(connection, i => i); var allianceRattings = new List <IAllianceRatingOut>(); foreach (var i in allianses) { allianceRattings.Add(SetAllianceRating(connection, i, true, profileService)); } var dataSerch = new TabAllianceSerchOut { Collection = allianceRattings }; dataSerch.AddAlianceButtons(allianceId); var userAlliance = _getMyAllianceFromRattingTab(connection, dataSerch.Collection, userId, allianceId, profileService); var role = AllianceRoleHelper.GetByRoleId(currentAllianceUser.RoleId); userAlliance.AllianceTechesOut = GetAllianceTechesOut(connection, userAlliance.Id, role); var manageAlliance = _getManageTab(connection, currentAllianceUser, role); var tabs = AllianceOut.InitialTabs(dataSerch, userAlliance, manageAlliance, _localizer); return(tabs); }
/// <summary> /// </summary> /// <param name="pvpPoint"></param> /// <param name="skip"></param> /// <exception cref="ArgumentNullException">Error.ConnectionUserNotExist</exception> /// <exception cref="ArgumentNullException">Error.ConnectionUserNotConnected</exception> /// <returns></returns> public async Task <TabAllianceSerchOut> AllianceGetAllianceItemByMinRating(int pvpPoint, int skip) { return(await _contextAction(connection => { var cr = _getLocalUser(Context.ConnectionId); var alliances = _allianceService.GetAlliancesByRating(connection, pvpPoint, skip, i => i); var allianceRatings = new List <IAllianceRatingOut>(); foreach (var alliance in alliances) { allianceRatings.Add(_allianceService.SetAllianceRating(connection, alliance, true, _gameUserService)); } var allianceTab = new TabAllianceSerchOut { Collection = allianceRatings }; allianceTab.AddAlianceButtons(cr.AllianceId); return allianceTab; })); }