Ejemplo n.º 1
0
        /// <summary>
        /// Adds the members to the list
        /// </summary>
        /// <returns></returns>
        public static List <BadgeTypeTimeLastChecked> BadgeTypeTimeLastChecked(List <BadgeTypeTimeLastChecked> entityList)
        {
            var membersIds = entityList.Select(x => x.MemberId).ToList();
            var members    = MemberMapper.MapMember(membersIds);

            foreach (var entity in entityList)
            {
                var member = members.FirstOrDefault(x => x.Id == entity.MemberId);
                entity.Member = member;
            }
            return(entityList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Extension method to complete the Post model with full Members
        /// </summary>
        /// <param name="entityList"></param>
        /// <returns></returns>
        public static List <Post> CompleteModels(this List <Post> entityList)
        {
            // Map full Members
            var membersIds = entityList.Select(x => x.MemberId).ToList();
            var members    = MemberMapper.MapMember(membersIds);

            foreach (var entity in entityList)
            {
                var member = members.FirstOrDefault(x => x.Id == entity.MemberId);
                entity.Member = member;
            }
            return(entityList);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Maps full members and categories into the model
        /// </summary>
        /// <param name="entityList"></param>
        /// <returns></returns>
        public static List <CategoryNotification> CompleteModels(List <CategoryNotification> entityList)
        {
            // Map full Members
            var membersIds = entityList.Select(x => x.MemberId).ToList();
            var members    = MemberMapper.MapMember(membersIds);

            foreach (var entity in entityList)
            {
                var member = members.FirstOrDefault(x => x.Id == entity.MemberId);
                entity.Member = member;
            }

            // Map full categories
            var catIds = entityList.Select(x => x.CategoryId).ToList();
            var cats   = MapCategory(catIds);

            foreach (var entity in entityList)
            {
                var cat = cats.FirstOrDefault(x => x.Id == entity.CategoryId);
                entity.Category = cat;
            }

            return(entityList);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Extension method to complete the PrivateMessage model with full Members (To and From)
        /// </summary>
        /// <param name="entityList"></param>
        /// <returns></returns>
        public static List <PrivateMessage> CompleteModels(this List <PrivateMessage> entityList)
        {
            // Get all ids and map into members
            var membersIds = entityList.Select(x => x.MemberToId).ToList();

            membersIds.AddRange(entityList.Select(x => x.MemberFromId));
            var members = MemberMapper.MapMember(membersIds.Distinct().ToList());

            // Mapp all TO members
            foreach (var entity in entityList)
            {
                var member = members.FirstOrDefault(x => x.Id == entity.MemberToId);
                entity.MemberTo = member;
            }

            //Map all FROM members
            foreach (var entity in entityList)
            {
                var member = members.FirstOrDefault(x => x.Id == entity.MemberFromId);
                entity.MemberFrom = member;
            }

            return(entityList);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Extension method to complete the Vote model with full Members (inc Voted By members)
        /// </summary>
        /// <param name="entityList"></param>
        /// <returns></returns>
        public static List <Vote> CompleteModels(this List <Vote> entityList)
        {
            // Get all ids and map into members
            var membersIds = entityList.Select(x => x.MemberId).ToList();

            membersIds.AddRange(entityList.Select(x => x.VotedByMemberId));
            var members = MemberMapper.MapMember(membersIds.Distinct().ToList());

            // Mapp all members
            foreach (var entity in entityList)
            {
                var member = members.FirstOrDefault(x => x.Id == entity.MemberId);
                entity.Member = member;
            }

            //Map all Voted By members
            foreach (var entity in entityList)
            {
                var member = members.FirstOrDefault(x => x.Id == entity.VotedByMemberId);
                entity.VotedByMember = member;
            }

            return(entityList);
        }