예제 #1
0
        public static List <ClanWarPick> SelectAttacksAvailableForWar(int id)
        {
            List <ClanWarPick> memberList       = ClanWarPicksManager.SelectAllByWarId(id);
            List <WarRanking>  allMemberAttacks = RankingsManager.SelectRankingsByClanWarId(id);

            if (allMemberAttacks.Any())
            {
                List <int> membersWithBothAttacks = allMemberAttacks.GroupBy(g => g.clanUserId).Where(p => p.Count() == 2).Select(p => p.Key).ToList();
                memberList = memberList.Where(p => !membersWithBothAttacks.Contains(p.clanUserId)).ToList();
            }

            return(memberList);
        }
예제 #2
0
        /// <summary>
        /// Deletes the Picks of the current Clan War
        /// </summary>
        public static bool Delete(int warId)
        {
            bool isDeleted = false;

            using (var dbContext = new HouseOfClansEntities())
            {
                dbContext.WarRankings.RemoveRange(dbContext.WarRankings.Where(p => p.clanWarId == warId));
                dbContext.SaveChanges();
            }

            isDeleted = !RankingsManager.SelectRankingsByClanWarId(warId).Any();

            return(isDeleted);
        }