Beispiel #1
0
        public ActionResult GetBlockList()

        {
            try
            {
                var aspnetUser = new ApplicationMandatoryService();
                var result1    = aspnetUser.Getuserlist(SessionToken);

                BlockViewModel blockModel = new BlockViewModel();
                blockModel.ProfilePic      = new List <string>();
                blockModel.BlockedUserName = new List <string>();
                blockModel.usertype        = new List <string>();
                blockModel.blockModelList  = new List <BlockModel>();
                var result = data.GetBlockList(SessionToken).Entity.ToList();
                if (result.Count != 0)
                {
                    foreach (var item in result)
                    {
                        blockModel.BlockedUserName.Add(aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.BlockedUser).UserName);
                        blockModel.ProfilePic.Add(Imageget(data.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.BlockedUser) == null ? null : data.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.BlockedUser).ProfilePicData));
                        blockModel.usertype.Add(result1.Entity.FirstOrDefault(f => f.Id == item.BlockedUser).Usertype.ToString());
                    }

                    blockModel.blockModelList.AddRange(result);
                }
                else
                {
                    return(View());
                }



                return(View(blockModel));
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
Beispiel #2
0
        public Tuple <List <EventRegistrationfromOrganizerModel>, List <LikesModel>, List <ShareModel>, List <SubscribersModel>, List <CommentModel>, List <SubCommentModel> > GetData(DateTime afterDate)
        {
            try
            {
                var                     basicfunctionality = new BasicFunctionalityofentireappService();
                var                     userId             = System.Web.HttpContext.Current.Session["UserId"] as string;
                List <string>           likepic            = new List <string>();
                List <LikesModel>       Like                     = new List <LikesModel>();
                List <string>           sharepic                 = new List <string>();
                List <ShareModel>       share                    = new List <ShareModel>();
                List <string>           subscriberpic            = new List <string>();
                List <SubscribersModel> subscriber               = new List <SubscribersModel>();
                List <string>           eventOpic                = new List <string>();
                List <EventRegistrationfromOrganizerModel> Event = new List <EventRegistrationfromOrganizerModel>();
                List <string>          commentPic                = new List <string>();
                List <CommentModel>    comment                   = new List <CommentModel>();
                List <string>          subCommentPic             = new List <string>();
                List <SubCommentModel> subComment                = new List <SubCommentModel>();


                using (ConquerorHubEntities dc = new ConquerorHubEntities())
                {
                    var likeid         = dc.CH_Likes.Where(a => a.DateandTime > afterDate && a.DestinationUserId == userId && a.LikeStatus == true).Select(a => a.SourceUserId).ToList();
                    var shareid        = dc.CH_ShareTable.Where(a => a.DateTime > afterDate && a.SourcePage == userId).OrderByDescending(a => a.DateTime).Select(x => x.SourcePage);
                    var subscriberid   = dc.CH_SubscriptionTable.Where(a => a.Datetime > afterDate && a.ProfileUserId == userId && a.SubscriptionStatus == true).OrderByDescending(a => a.Datetime).Select(a => a.ProfileUserId).ToList();
                    var subscribertoid = dc.CH_SubscriptionTable.Where(a => a.Datetime > afterDate && a.ProfileUserId == userId && a.SubscriptionStatus == true).OrderByDescending(a => a.Datetime).Select(a => a.SubscriberUserId).ToList();
                    var commentId      = dc.CH_CommentTable.Where(a => a.CommentedDate > afterDate && a.DestinationUserId == userId).Select(a => a.SourceUserId).ToList();
                    var subCommentId   = dc.CH_SubComment.Where(a => a.SubCommentDatetime > afterDate && a.DestinationUserId == userId).Select(a => a.SourceUserId).ToList();



                    foreach (var item in subscribertoid)
                    {
                        eventOpic.Add(Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item).ProfilePicData));
                    }
                    foreach (var item in subscribertoid)
                    {
                        Event.AddRange(from a in dc.CH_EventRegistrationFromOrganizer where (a.StartofEventRegistration > afterDate)select new EventRegistrationfromOrganizerModel()
                        {
                            aboutEvent = new AboutEvent()
                            {
                                EventId = a.EventId, NameofOrganizer = a.NameofOrganizer, Profilepic = item
                            }
                        });
                    }


                    foreach (var item in likeid)
                    {
                        likepic.Add(Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item).ProfilePicData));
                    }



                    foreach (var item in commentId)
                    {
                        commentPic.Add(Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item).ProfilePicData));
                    }
                    foreach (var item in subCommentId)
                    {
                        subCommentPic.Add(Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item).ProfilePicData));
                    }

                    foreach (var item in likepic)
                    {
                        Like.AddRange(dc.CH_Likes.Where(a => a.DateandTime > afterDate && a.DestinationUserId == userId && a.LikeStatus == true).OrderByDescending(a => a.DateandTime).Select(a => new LikesModel()
                        {
                            SourceUserId = a.SourceUserId, DestinationUserId = a.DestinationUserId, Imageid = a.Imageid, UserName = dc.AspNetUsers.Where(x => x.Id == a.SourceUserId).Select(x => x.UserName).FirstOrDefault(), profilepic = item
                        }));
                    }
                    foreach (var item in commentPic)
                    {
                        comment.AddRange(dc.CH_CommentTable.Where(a => a.CommentedDate > afterDate && a.DestinationUserId == userId).OrderByDescending(a => a.CommentedDate).Select(a => new CommentModel()
                        {
                            SourceUserId = a.SourceUserId, DestinationUserId = a.DestinationUserId, PostId = a.PostId, UserName = dc.AspNetUsers.Where(x => x.Id == a.SourceUserId).Select(x => x.UserName).FirstOrDefault(), ProfilePic = item
                        }));
                    }
                    foreach (var item in subCommentPic)
                    {
                        subComment.AddRange(dc.CH_SubComment.Where(a => a.SubCommentDatetime > afterDate && a.DestinationUserId == userId).OrderByDescending(a => a.SubCommentDatetime).Select(a => new SubCommentModel()
                        {
                            SourceUserId = a.SourceUserId, DestinationUserId = a.DestinationUserId, PostId = a.PostId, UserName = dc.AspNetUsers.Where(x => x.Id == a.SourceUserId).Select(x => x.UserName).FirstOrDefault(), ProfilePic = item
                        }));
                    }

                    foreach (var item in shareid)
                    {
                        sharepic.Add(Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item).ProfilePicData));
                    }
                    foreach (var item in sharepic)
                    {
                        share.AddRange(dc.CH_ShareTable.Where(a => a.DateTime > afterDate && a.SourcePage == userId).OrderByDescending(a => a.DateTime).Select(a => new ShareModel()
                        {
                            PostId = a.PostId, UserName = dc.AspNetUsers.Where(x => x.Id == a.DestinationPage).Select(x => x.UserName).FirstOrDefault(), profilepic = item
                        }).ToList());
                    }

                    foreach (var item in subscriberid)
                    {
                        subscriberpic.Add((Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item).ProfilePicData)));
                    }
                    foreach (var item in subscriberpic)
                    {
                        subscriber.AddRange(dc.CH_SubscriptionTable.Where(a => a.Datetime > afterDate && a.ProfileUserId == userId && a.SubscriptionStatus == true).OrderByDescending(a => a.Datetime).Select(a => new SubscribersModel()
                        {
                            SubscriberUserId = a.SubscriberUserId, Subscribersname = dc.AspNetUsers.Where(x => x.Id == a.SubscriberUserId).Select(x => x.UserName).FirstOrDefault(), profilepic = item
                        }).ToList());
                    }


                    // var votes = dc.CH_VoteTable.Where(a => a.DateTime >afterDate ).OrderByDescending(a => a.DateTime).Select(a => new VotesModel() { PostId = a.PostId, userid = a.userid }).ToList();

                    var abc = new Tuple <List <EventRegistrationfromOrganizerModel>, List <LikesModel>, List <ShareModel>, List <SubscribersModel>, List <CommentModel>, List <SubCommentModel> >(Event, Like, share, subscriber, comment, subComment);
                    return(abc);
                }
            }
            catch (Exception ex) {
                throw;
            }
        }
        public async Task <ActionResult> EventsPage(Guid?Userid)
        {
            if (Userid != null)
            {
                ViewBag.UserId = Userid;
            }

            else
            {
                Userid = Guid.Parse(User.Identity.GetUserId());
            }

            EventRegistrationfromOrganizerModel obj = new EventRegistrationfromOrganizerModel();

            obj.aboutEventlist        = new List <AboutEvent>();
            obj.aboutParticipantslist = new List <AboutParticipants>();
            obj.importantDateslist    = new List <ImportantDates>();
            obj.awardRewardlist       = new List <AwardsAndRewards>();
            EventsServices serviceObj = new EventsServices();
            OrganiserBasicDetailsServices services = new OrganiserBasicDetailsServices();
            var eventpost = await services.GetEventRegistrationImageVideo(SessionToken);

            obj.ImagevideoList = new List <EventsImageandVideo>();
            var basicfunctionality = new BasicFunctionalityofentireappService();
            var aspnetUser         = new ApplicationMandatoryService();
            var getSubscribeuser   = new List <EventRegistrationfromOrganizerModel>();

            if (eventpost.Count != 0)
            {
                foreach (var item in eventpost)
                {
                    obj.ImagevideoList.Add(new EventsImageandVideo()
                    {
                        EventIdImageorVideo = item.Imagevideo.EventIdImageorVideo,
                        OrganizerId         = item.Imagevideo.OrganizerId,
                        Image      = item.Imagevideo.EventImage != null ? Imageget(item.Imagevideo.EventImage) : null,
                        UserName   = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.Imagevideo.OrganizerId).UserName,
                        Profilepic = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.Imagevideo.OrganizerId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.Imagevideo.OrganizerId).ProfilePicData)
                    });
                }
            }
            try
            {
                var Aboutevent       = serviceObj.GetRegistrationAboutEvent(SessionToken, Userid).Entity.ToList();
                var Aboutparticipant = serviceObj.GetORegistrtionAboutParticipant(SessionToken, Userid).Entity.ToList();
                var AwardReward      = serviceObj.GetAwardAndReward(SessionToken, Userid).Entity.ToList();
                var impdates         = serviceObj.GetImportantDateAndTime(SessionToken, Userid).Entity.ToList();


                obj.aboutEventlist.AddRange(Aboutevent);
                obj.aboutParticipantslist.AddRange(Aboutparticipant);
                obj.importantDateslist.AddRange(impdates);
                obj.awardRewardlist.AddRange(AwardReward);
                if (obj == null)
                {
                    return(View());
                }
                return(View(obj));
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
        public async Task <ActionResult> ParticipantProfile(Guid?userid)
        {
            if (userid != null)
            {
                ViewBag.UserId = userid;
                var usertype = UserManager.FindById(userid.ToString()).Usertype;
                if (usertype == 1)
                {
                    return(RedirectToAction("Home", "OrganizerBasicDetails", new { UserId = userid }));
                }
            }
            else if (userid == null)
            {
                userid = new Guid(User.Identity.GetUserId());
                var usertype = UserManager.FindById(User.Identity.GetUserId()).Usertype;
                if (usertype == 1)
                {
                    return(RedirectToAction("Home", "OrganizerBasicDetails"));
                }
            }

            var basicfunctionality = new BasicFunctionalityofentireappService();
            var aspnetUser         = new ApplicationMandatoryService();
            HomePageViewModel obj  = new HomePageViewModel();

            obj.aboutEventlist         = new List <AboutEvent>();
            obj.aboutParticipantslist1 = new List <AboutParticipants>();
            obj.importantDateslist1    = new List <ImportantDates>();
            obj.awardRewardlist1       = new List <AwardsAndRewards>();
            EventsServices serviceObj  = new EventsServices();
            var            commentlist = basicfunctionality.GetcommentCount(SessionToken).Entity.Where(y => y.DestinationUserId == UserId.ToString()).Select(x => x).ToList();
            var            rsult       = basicfunctionality.GetTotalLikesOfPost(SessionToken).Entity.Where(y => y.DestinationUserId == UserId.ToString()).Select(x => x).ToList();
            Sponsor1       sp          = new Sponsor1();

            obj.sponsorSingleData             = new Sponsor1();
            obj.sponsorSingleData.LikeList    = new List <LikesModel>();
            obj.sponsorSingleData.commentList = new List <CommentModel>();
            obj.sponsorSingleData.commentList.AddRange(commentlist);
            obj.sponsorSingleData.LikeList.AddRange(rsult);
            var services = new OrganiserBasicDetailsServices();
            var status1  = await services.GetEventRegistrationImageVideo(SessionToken);

            var status = status1.Where(x => x.Imagevideo.OrganizerId == UserId.ToString() && x.Imagevideo.EventStatus == 1).Select(x => x).ToList();

            obj.EventRegistration = new List <EventRegistrationfromOrganizerModel>();


            foreach (var item in status)
            {
                try
                {
                    // obj.aboutEventlist.Add(serviceObj.GetRegistrationAboutEvent(SessionToken, UserId).Entity.Where(x => x.EventId == item.Imagevideo.EventId && x.EventStatus==1).FirstOrDefault());
                    //obj.aboutParticipantslist1.Add(serviceObj.GetORegistrtionAboutParticipant(SessionToken, UserId).Entity.Where(x => x.EventId == item.Imagevideo.EventId && x.EventStatus == 1).FirstOrDefault());
                    // obj.awardRewardlist1.Add(serviceObj.GetAwardAndReward(SessionToken, UserId).Entity.Where(x => x.EventId == item.Imagevideo.EventId && x.EventStatus == 1).FirstOrDefault());
                    //obj.importantDateslist1.Add(serviceObj.GetImportantDateAndTime(SessionToken, UserId).Entity.Where(x => x.EventId == item.Imagevideo.EventId && x.EventStatus == 1).FirstOrDefault());

                    obj.EventRegistration.Add(new EventRegistrationfromOrganizerModel()
                    {
                        Imagevideo = new EventsImageandVideo()
                        {
                            EventIdImageorVideo = item.Imagevideo.EventIdImageorVideo,
                            OrganizerId         = item.Imagevideo.OrganizerId,
                            Image            = item.Imagevideo.EventImage != null ? Imageget(item.Imagevideo.EventImage) : null,
                            EventVideo       = item.Imagevideo.EventVideo,
                            imageorvideo     = item.Imagevideo.imageorvideo,
                            Homedisplayevent = item.Imagevideo.Homedisplayevent,
                            EventStatus      = item.Imagevideo.EventStatus,
                            Profilepic       = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()).ProfilePicData)
                        }
                    });
                }
                catch (Exception ex)
                {
                    return(View("~/Views/Errorpage/Errorpage.cshtml"));
                }
            }



            obj.Sharedata = new List <ShareModel>();

            var PostId = new List <Guid?>();
            var data   = new BasicFunctionalityofentireappService();

            var result = data.GetTotalShare(SessionToken).Entity;

            if (result != null)
            {
                obj.Sharedata = result.Where(x => x.DestinationPage == UserId.ToString()).Select(x => x).ToList() == null ? null : result.Where(x => x.DestinationPage == UserId.ToString()).Select(x => x).ToList();
                if (obj.Sharedata.Count() != 0)
                {
                    var xyz = obj.Sharedata.Select(x => x.PostId).ToList();
                    PostId         = xyz;
                    ViewBag.Postid = PostId;
                }
                else
                {
                    ViewBag.Postid = null;
                }
            }


            //Get sponsored shred data
            var sponsorlist = services.GetSponsorList(SessionToken, UserId);

            obj.sponsorMultipleData         = new List <Sponsor1>();
            obj.sponsorSingleData.sharelist = new List <ShareModel>();
            if (result != null)
            {
                obj.sponsorSingleData.sharelist.AddRange(result);
            }
            var sponsortemp = new List <Sponsor1>();

            if (ViewBag.Postid != null)
            {
                if (sponsorlist.Entity.Count != 0)
                {
                    foreach (var item in ViewBag.Postid)
                    {
                        sponsortemp.AddRange(sponsorlist.Entity.Where(a => a.ImageId == item).Select(a => a).ToList());
                    }
                    foreach (var item in sponsortemp)
                    {
                        obj.sponsorMultipleData.Add(new Sponsor1()
                        {
                            Id          = item.Id,
                            Image       = item.Image,
                            Image1      = Imageget(item.Image),
                            ImageId     = item.ImageId,
                            UserName    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == (UserId.ToString() == null ? User.Identity.GetUserId() : UserId.ToString())).UserName,
                            Caption     = item.Caption,
                            DateandTime = item.DateandTime,
                            UserId      = User.Identity.GetUserId(),
                            profilepic  = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()).ProfilePicData)
                        });
                    }
                }
            }
            //get participant gallery post shared
            obj.GalleryList = new List <GalleryModel>();
            var participantGalleryList = await services.GetParticipantGallerydata(SessionToken);

            var listtemp = new List <GalleryModel>();

            if (ViewBag.Postid != null)
            {
                if (participantGalleryList.Count != 0)
                {
                    foreach (var item in ViewBag.Postid)
                    {
                        listtemp.AddRange(participantGalleryList.Where(a => a.PostId == item && a.UserId == UserId.ToString()).Select(a => a).ToList());
                    }
                    foreach (var item in listtemp)
                    {
                        obj.GalleryList.Add(new GalleryModel()
                        {
                            Id          = item.Id,
                            Image       = item.ImageData == null ? null : Imageget(item.ImageData),
                            Caption     = item.Caption,
                            UserId      = item.UserId,
                            PostId      = item.PostId,
                            VideoData   = item.VideoData,
                            ContentType = item.ContentType,
                            UserName    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == (ViewBag.UserId as string == null ? User.Identity.GetUserId() : ViewBag.UserId as string)).UserName,
                            Profilepic  = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId).ProfilePicData)
                        });
                    }
                }
            }

            var participantRegistration = await services.GetParticipantRegistration(SessionToken);

            var participantregdata = new List <ParticipationRegistrationModel>();

            obj.Participantregistration = new List <ParticipationRegistrationModel>();
            string extension = "";

            if (ViewBag.Postid != null)
            {
                if (participantRegistration.Count != 0)
                {
                    foreach (var item in ViewBag.Postid)
                    {
                        participantregdata.AddRange(participantRegistration.Where(x => x.VideoId == item).Select(x => x).ToList());
                    }

                    foreach (var item in participantregdata)
                    {
                        extension = item.ContentType.Split('.').Last();
                        obj.Participantregistration.Add(new ParticipationRegistrationModel()
                        {
                            Data            = extension == "mp4" ? item.Data : null,
                            Images          = extension != "mp4" ? Imageget(item.Data) : null,
                            OrganizerId     = item.OrganizerId,
                            ParticipantId   = item.ParticipantId,
                            EventId         = item.EventId,
                            VideoId         = item.VideoId,
                            Name            = item.Name,
                            Qualification   = item.Qualification,
                            CollegeorSchool = item.CollegeorSchool,
                            UserName        = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == (UserId.ToString() == null ? User.Identity.GetUserId() : UserId.ToString())).UserName,
                            Profilepic      = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()).ProfilePicData)
                        });
                    }
                }
            }
            obj.homeList = new List <Home>();
            var data4 = await services.GetHomePage(SessionToken);

            var homeData = new List <Home>();

            if (ViewBag.Postid != null)
            {
                if (data4.Count != 0)
                {
                    foreach (var item in ViewBag.Postid)
                    {
                        homeData.AddRange(data4.Where(x => x.Postid == item).Select(x => x).ToList());
                    }
                    foreach (var item in homeData)
                    {
                        obj.homeList.Add(new Home()
                        {
                            Id         = item.Id,
                            UserId     = item.UserId,
                            PostText   = item.PostText,
                            Image2     = item.Image == null ? null : Imageget(item.Image),
                            Video      = item.Video,
                            DateTime   = item.DateTime,
                            UserName   = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == (UserId.ToString() == null ? User.Identity.GetUserId() : UserId.ToString())).UserName,
                            Profilepic = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()).ProfilePicData),
                            Postid     = item.Postid
                        });
                    }
                }
            }

            obj.Imagevideolist = new List <EventsImageandVideo>();
            var data5 = await services.GetEventRegistrationImageVideo(SessionToken);

            var eventData = new List <EventRegistrationfromOrganizerModel>();

            if (ViewBag.Postid != null)
            {
                if (data5.Count != 0)
                {
                    foreach (var item in ViewBag.Postid)
                    {
                        eventData.AddRange(data5.Where(x => x.Imagevideo.EventIdImageorVideo == item).Select(x => x).ToList());
                    }
                    foreach (var item in eventData)
                    {
                        obj.Imagevideolist.Add(new EventsImageandVideo()
                        {
                            EventIdImageorVideo = item.Imagevideo.EventIdImageorVideo,
                            OrganizerId         = item.Imagevideo.OrganizerId,
                            Image      = item.Imagevideo.EventImage == null ? null : Imageget(item.Imagevideo.EventImage),
                            EventVideo = item.Imagevideo.EventVideo,



                            UserName   = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == (UserId.ToString() == null ? User.Identity.GetUserId() : UserId.ToString())).UserName,
                            Profilepic = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == User.Identity.GetUserId()).ProfilePicData),
                        });
                    }
                }
            }


            return(View(obj));
        }
        //public ActionResult ProfilePage(Guid? UserId)
        //{
        //    if (UserId != null)
        //    {
        //        ViewBag.UserId = UserId;
        //    }
        //    return View();

        //}
        public async Task <ActionResult> ParticipantHome(Guid?UserId)
        {
            if (UserId != null)
            {
                ViewBag.UserId = UserId;
            }
            else
            {
                UserId = Guid.Parse(User.Identity.GetUserId());
            }


            var aspnetUser         = new ApplicationMandatoryService();
            var basicfunctionality = new BasicFunctionalityofentireappService();
            //HomePage block
            var data = await services.GetHomePage(SessionToken);

            var result = new List <Home>();

            if (data != null)
            {
                result = data.Where(x => x.UserId == UserId.ToString()).Select(x => x).ToList();
            }
            var obj = new CH_HomeViewModel();

            obj.homeList = new List <Home>();
            var profilepic = basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == UserId.ToString()) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == UserId.ToString());

            if (profilepic != null)
            {
            }
            if (result.Count != 0)
            {
                foreach (var item in result)
                {
                    obj.homeList.Add(new Home()
                    {
                        Id         = item.Id,
                        UserId     = item.UserId,
                        PostText   = item.PostText,
                        Image2     = item.Image == null ? null : Imageget(item.Image),
                        Video      = item.Video,
                        DateTime   = item.DateTime,
                        UserName   = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.UserId).UserName,
                        Profilepic = Imageget(profilepic != null ? profilepic.ProfilePicData : null),
                        Postid     = item.Postid
                    });
                }
            }

            //Getting subscribed to userid
            obj.subscriberViewModel = new SubscribersViewmodel();
            obj.subscriberViewModel.Subcsriberslist = new List <SubscribersModel>();
            var basicdata        = new BasicFunctionalityofentireappService();
            var subscribedToData = basicdata.GetTotalSubscribersperProfile(SessionToken).Entity;

            obj.subscriberViewModel.Subcsriberslist = subscribedToData.Where(x => x.SubscriberUserId == User.Identity.GetUserId() && x.SubscriptionStatus == true).Select(x => x).ToList();
            if (obj.subscriberViewModel.Subcsriberslist.Count() != 0)
            {
                var xyz = obj.subscriberViewModel.Subcsriberslist.Select(x => x.ProfileUserId);
                ViewBag.ProfileUserId = xyz.ToList();
            }

            else
            {
                ViewBag.ProfileUserId = null;
            }
            //Get like list  and comment list
            Sponsor1 sp = new Sponsor1();

            obj.sponsorSingleData          = new Sponsor1();
            obj.sponsorSingleData.LikeList = new List <LikesModel>();
            obj.sponsorSingleData.LikeList.AddRange(basicfunctionality.GetTotalLikesOfPost(SessionToken).Entity.Where(y => y.SourceUserId == User.Identity.GetUserId()).Select(x => x).ToList());
            obj.sponsorSingleData.commentList = new List <CommentModel>();
            obj.sponsorSingleData.commentList.AddRange(basicfunctionality.GetcommentCount(SessionToken).Entity.Where(y => y.SourceUserId == User.Identity.GetUserId()).Select(x => x).ToList());



            if (ViewBag.ProfileUserId != null)
            {
                foreach (var item in ViewBag.ProfileUserId)
                {
                    obj.sponsorSingleData.LikeList.AddRange(basicfunctionality.GetTotalLikesOfPost(SessionToken).Entity.Where(y => y.SourceUserId == item).Select(x => x).ToList());
                }
            }
            if (ViewBag.ProfileUserId != null)
            {
                foreach (var item in ViewBag.ProfileUserId)
                {
                    obj.sponsorSingleData.commentList.AddRange(basicfunctionality.GetcommentCount(SessionToken).Entity.Where(y => y.SourceUserId == item).Select(x => x).ToList());
                }
            }
            //Event uploaded post
            var eventpost = await services.GetEventRegistrationImageVideo(SessionToken);

            obj.ImageVideolist = new List <EventsImageandVideo>();
            var getSubscribeuser = new List <EventRegistrationfromOrganizerModel>();

            if (ViewBag.ProfileUserId != null)
            {
                if (eventpost.Count != 0)
                {
                    foreach (var item in ViewBag.ProfileUserId)
                    {
                        getSubscribeuser.AddRange(eventpost.Where(x => x.Imagevideo.OrganizerId == item).Select(x => x).ToList());
                    }
                    foreach (var item in getSubscribeuser)
                    {
                        obj.ImageVideolist.Add(new EventsImageandVideo()
                        {
                            EventIdImageorVideo = item.Imagevideo.EventIdImageorVideo,
                            OrganizerId         = item.Imagevideo.OrganizerId,
                            Image      = item.Imagevideo.EventImage != null ? Imageget(item.Imagevideo.EventImage) : null,
                            UserName   = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.Imagevideo.OrganizerId).UserName,
                            Profilepic = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.Imagevideo.OrganizerId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.Imagevideo.OrganizerId).ProfilePicData),
                        });
                    }
                }
            }


            //Subscribed to home post (uploaded post)

            obj.Homelistofsubscribed = new List <Home>();
            var data4 = await services.GetHomePage(SessionToken);

            var getsubscriberhome = new List <Home>();;

            if (ViewBag.ProfileUserId != null)
            {
                if (data4.Count != 0)
                {
                    foreach (var item in ViewBag.ProfileUserId)
                    {
                        getsubscriberhome.AddRange(data4.Where(x => x.UserId == item).Select(x => x).ToList());
                    }
                    foreach (var item in getsubscriberhome)
                    {
                        obj.Homelistofsubscribed.Add(new Home()
                        {
                            Id         = item.Id,
                            UserId     = item.UserId,
                            PostText   = item.PostText,
                            Image2     = item.Image == null ? null : Imageget(item.Image),
                            Video      = item.Video,
                            DateTime   = item.DateTime,
                            UserName   = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.UserId).UserName,
                            Profilepic = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId).ProfilePicData),
                            Postid     = item.Postid
                        });
                    }
                }
            }
            //get sponsor uploaded data

            var sponsorlist = services.GetSponsorList(SessionToken, UserId);

            obj.sponsorListdata = new List <Sponsor1>();
            var list = new List <Sponsor1>();

            if (ViewBag.ProfileUserId != null)
            {
                foreach (var item in ViewBag.ProfileUserId)
                {
                    list.AddRange(sponsorlist.Entity.Where(x => x.UserId == item).Select(x => x).OrderBy(m => m.DateandTime).ToList());
                }
                foreach (var item in list)
                {
                    obj.sponsorListdata.Add(new Sponsor1()
                    {
                        Id    = item.Id,
                        Image = item.Image,

                        Image1      = Imageget(item.Image),
                        ImageId     = item.ImageId,
                        UserName    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.UserId).UserName,
                        Caption     = item.Caption,
                        DateandTime = item.DateandTime,
                        UserId      = item.UserId,
                        profilepic  = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId).ProfilePicData)
                    });
                }
            }
            //Participant gallery(uploaded post)
            obj.GalleryList = new List <GalleryModel>();
            var participantGalleryList = await services.GetParticipantGallerydata(SessionToken);

            var filteredParticipantGallery = new List <GalleryModel>();

            if (ViewBag.ProfileUserId != null)
            {
                if (participantGalleryList.Count != 0)
                {
                    foreach (var item in ViewBag.ProfileUserId)
                    {
                        filteredParticipantGallery = participantGalleryList.Where(x => x.UserId == item).ToList();
                    }
                }
                foreach (var item in filteredParticipantGallery)
                {
                    obj.GalleryList.Add(new GalleryModel()
                    {
                        Id = item.Id,

                        Caption     = item.Caption,
                        UserId      = item.UserId,
                        PostId      = item.PostId,
                        VideoData   = item.VideoData != null ? item.VideoData : null,
                        ContentType = item.ContentType,
                        Image       = item.ImageData != null ? Imageget(item.ImageData) : null,
                        UserName    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.UserId).UserName,
                        Profilepic  = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId).ProfilePicData),
                        DateAndTime = item.DateAndTime
                    });
                }
            }
            //get shared post of subscribed to users   (shared post)
            var basicFunctionality = new BasicFunctionalityofentireappService();
            var totalShare         = basicFunctionality.GetTotalShare(SessionToken).Entity;
            var sharefilter        = new List <Guid?>();
            var sourceCount        = new List <ShareModel>();

            if (ViewBag.ProfileUserId != null)
            {
                foreach (var item in ViewBag.ProfileUserId)
                {
                    sharefilter = totalShare.Where(x => x.DestinationPage == item).Select(x => x.PostId).ToList();
                    sourceCount = totalShare.Where(x => x.SourcePage == item).Select(x => x).ToList();
                }
            }
            //Sponsored shared data
            obj.sponsorSingleData.sharelist = new List <ShareModel>();
            obj.sponsorSingleData.sharelist.AddRange(totalShare.ToList());
            obj.sponsorMultipleData = new List <Sponsor1>();
            var list1 = new List <Sponsor1>();

            if (sharefilter != null)
            {
                foreach (var item in sharefilter)
                {
                    list1.AddRange(sponsorlist.Entity.Where(x => x.ImageId == item).Select(x => x).OrderBy(m => m.DateandTime).ToList());
                }
                foreach (var item in list1)
                {
                    obj.sponsorMultipleData.Add(new Sponsor1()
                    {
                        Id          = item.Id,
                        Image       = item.Image,
                        Image1      = Imageget(item.Image),
                        ImageId     = item.ImageId,
                        UserName    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.UserId).UserName,
                        Caption     = item.Caption,
                        DateandTime = item.DateandTime,
                        UserId      = item.UserId,
                        profilepic  = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId).ProfilePicData),
                    });
                }
            }

            //participant shared post

            var participantRegistration = await services.GetParticipantRegistration(SessionToken);

            var participantregdata = new List <ParticipationRegistrationModel>();

            obj.Participantregistration = new List <ParticipationRegistrationModel>();
            if (sharefilter != null)
            {
                if (participantRegistration.Count != 0)
                {
                    foreach (var item in sharefilter)
                    {
                        participantregdata.AddRange(participantRegistration.Where(x => x.VideoId == item).Select(x => x).ToList());
                    }
                    foreach (var item in participantregdata)
                    {
                        obj.Participantregistration.Add(new ParticipationRegistrationModel()
                        {
                            Data            = item.ContentType == "mp4" ? item.Data : null,
                            Images          = item.ContentType != "mp4" ? Imageget(item.Data) : null,
                            OrganizerId     = item.OrganizerId,
                            ParticipantId   = item.ParticipantId,
                            EventId         = item.EventId,
                            VideoId         = item.VideoId,
                            Name            = item.Name,
                            Qualification   = item.Qualification,
                            CollegeorSchool = item.CollegeorSchool,
                            UserName        = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.OrganizerId).UserName,
                            Profilepic      = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.OrganizerId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.OrganizerId).ProfilePicData),
                        });
                    }
                }
            }
            //participant Gallery shared

            obj.GalleryListSubscribed = new List <GalleryModel>();
            var participantGalleryListSubscribed = await services.GetParticipantGallerydata(SessionToken);

            var gallerylist = new List <GalleryModel>();

            if (sharefilter != null)
            {
                if (participantGalleryListSubscribed.Count != 0)
                {
                    foreach (var item in sharefilter)
                    {
                        gallerylist.AddRange(participantGalleryListSubscribed.Where(x => x.PostId == item).Select(x => x).ToList());
                    }
                    foreach (var item in gallerylist)
                    {
                        obj.GalleryListSubscribed.Add(new GalleryModel()
                        {
                            Id          = item.Id,
                            Image       = item.ImageData == null ? null : Imageget(item.ImageData),
                            Caption     = item.Caption,
                            UserId      = item.UserId,
                            PostId      = item.PostId,
                            VideoData   = item.VideoData,
                            ContentType = item.ContentType,
                            UserName    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == item.UserId).UserName,
                            Profilepic  = Imageget(basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId) == null ? null : basicfunctionality.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == item.UserId).ProfilePicData),
                            DateAndTime = item.DateAndTime
                        });
                    }
                }
            }



            return(View(obj));
        }
        public ActionResult Subscribers(Guid?UserId)
        {
            var obj1    = new ApplicationMandatoryService();
            var result1 = obj1.Getuserlist(SessionToken);
            SubscribersViewmodel obj = new SubscribersViewmodel();
            var data       = new BasicFunctionalityofentireappService();
            var aspnetUser = new ApplicationMandatoryService();

            obj.Subcsriberslist = new List <SubscribersModel>();
            if (UserId != null)
            {
                ViewBag.UserId = UserId;
                var result  = data.GetTotalSubscribersperProfile(SessionToken).Entity.Where(x => x.ProfileUserId == UserId.ToString() && x.SubscriptionStatus == true).Select(x => x).ToList();
                var result2 = data.GetTotalSubscribersperProfile(SessionToken).Entity.Where(x => x.SubscriberUserId == UserId.ToString() && x.SubscriptionStatus == true).Select(x => x).ToList();

                if (result != null)
                {
                    foreach (var item in result)
                    {
                        var user = result1.Entity.FirstOrDefault(f => f.Id == item.SubscriberUserId);
                        obj.Subcsriberslist.Add(new SubscribersModel()
                        {
                            SubscriberUserId   = user.Id,
                            Subscribersname    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == user.Id).UserName,
                            usertype           = user.Usertype.ToString(),
                            SubscriptionStatus = item.SubscriptionStatus,

                            profilepic = Imageget(data.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == user.Id) == null ? null : data.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == user.Id).ProfilePicData)
                        });
                    }
                }
                if (result2 != null)
                {
                    foreach (var item in result2)
                    {
                        var user = result1.Entity.FirstOrDefault(f => f.Id == item.ProfileUserId);
                        obj.Subcsriberslist.Add(new SubscribersModel()
                        {
                            ProfileUserId          = user.Id,
                            Subscribedtoname       = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == user.Id).UserName,
                            usertype               = user.Usertype.ToString(),
                            SubscriptionStatus     = item.SubscriptionStatus,
                            profilepicSubscribedto = Imageget(data.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == user.Id) == null ? null : data.GetMainPhotos(SessionToken).Entity.FirstOrDefault(x => x.UserId == user.Id).ProfilePicData)
                        });;
                    }
                }
            }
            else
            {
                var result  = data.GetTotalSubscribersperProfile(SessionToken).Entity.Where(x => x.ProfileUserId == User.Identity.GetUserId() && x.SubscriptionStatus == true).Select(x => x).ToList();
                var result2 = data.GetTotalSubscribersperProfile(SessionToken).Entity.Where(x => x.SubscriberUserId == User.Identity.GetUserId() && x.SubscriptionStatus == true).Select(x => x).ToList();
                if (result != null)
                {
                    foreach (var item in result)
                    {
                        var user = result1.Entity.FirstOrDefault(f => f.Id == item.SubscriberUserId);
                        obj.Subcsriberslist.Add(new SubscribersModel()
                        {
                            SubscriberUserId   = user.Id,
                            Subscribersname    = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == user.Id).UserName,
                            usertype           = user.Usertype.ToString(),
                            SubscriptionStatus = item.SubscriptionStatus,
                        });
                    }
                }
                if (result2 != null)
                {
                    foreach (var item in result2)
                    {
                        var user = result1.Entity.FirstOrDefault(f => f.Id == item.ProfileUserId);
                        obj.Subcsriberslist.Add(new SubscribersModel()
                        {
                            ProfileUserId      = user.Id,
                            Subscribedtoname   = aspnetUser.Getuserlist(SessionToken).Entity.FirstOrDefault(x => x.Id == user.Id).UserName,
                            usertype           = user.Usertype.ToString(),
                            SubscriptionStatus = item.SubscriptionStatus,
                        });;
                    }
                }
            }


            return(View(obj));
        }