public async Task <ActionResult> EventDetailsToParticipants(Guid?id, Guid?Userid)
        {
            if (Userid != null)
            {
                ViewBag.UserId = Userid;
            }
            else
            {
                Userid = Guid.Parse(User.Identity.GetUserId());
            }
            EventRegistrationfromOrganizerModel obj = new EventRegistrationfromOrganizerModel();

            obj.Imagevideo = new EventsImageandVideo();
            OrganiserBasicDetailsServices service = new OrganiserBasicDetailsServices();


            var ImageorVideo1 = await service.GetEventRegistrationImageVideo(SessionToken);

            var data = ImageorVideo1.Where(x => x.Imagevideo.EventIdImageorVideo == id).Select(x => x).FirstOrDefault();

            try
            {
                if (data.Imagevideo.EventImage != null)
                {
                    obj.Imagevideo.Image = Imageget(data.Imagevideo.EventImage);
                }
                if (data.Imagevideo.EventVideo != null)
                {
                    obj.Imagevideo.EventVideo          = data.Imagevideo.EventVideo;
                    obj.Imagevideo.EventIdImageorVideo = id;
                }
                ViewBag.Organizerid = data.Imagevideo.OrganizerId;


                obj.aboutEvent        = new AboutEvent();
                obj.aboutParticipants = new AboutParticipants();
                obj.importantDates    = new ImportantDates();
                obj.awardReward       = new AwardsAndRewards();

                EventsServices serviceObj = new EventsServices();
                var            Aboutevent = serviceObj.GetRegistrationAboutEvent(SessionToken, Userid).Entity.Where(x => x.EventId == id).Select(x => x).FirstOrDefault();
                var            result     = serviceObj.Geteventsubtype(SessionToken).Entity.Where(x => x.Id == Aboutevent.SubTypeOfEvent).Select(x => x) == null ? null : serviceObj.Geteventsubtype(SessionToken).Entity.FirstOrDefault(x => x.Id == Aboutevent.SubTypeOfEvent).EventSubType;
                Aboutevent.SubTypeOfEventstring = result;
                var Aboutparticipant = serviceObj.GetORegistrtionAboutParticipant(SessionToken, Userid).Entity.Where(x => x.EventId == id).Select(x => x).FirstOrDefault();
                var AwardReward      = serviceObj.GetAwardAndReward(SessionToken, Userid).Entity.Where(x => x.EventId == id).Select(x => x).FirstOrDefault();
                var impdates         = serviceObj.GetImportantDateAndTime(SessionToken, Userid).Entity.Where(x => x.EventId == id).Select(x => x).FirstOrDefault();
                obj.aboutEvent        = Aboutevent;
                obj.aboutParticipants = Aboutparticipant;
                obj.importantDates    = impdates;
                obj.awardReward       = AwardReward;


                return(View(obj));
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
        public ActionResult FutureEvents(Guid?Userid)
        {
            if (Userid != null)
            {
                ViewBag.UserId = Userid;
            }

            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();

            try
            {
                var Aboutevent       = serviceObj.GetRegistrationAboutEvent(SessionToken, Userid).Entity.Where(x => x.EventStatus == 1);
                var Aboutparticipant = serviceObj.GetORegistrtionAboutParticipant(SessionToken, Userid).Entity.Where(x => x.EventStatus == 1).ToList();
                var AwardReward      = serviceObj.GetAwardAndReward(SessionToken, Userid).Entity.Where(x => x.EventStatus == 1).ToList();
                var impdates         = serviceObj.GetImportantDateAndTime(SessionToken, Userid).Entity.Where(x => x.EventStatus == 1).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 ActionResult HallofFame(Guid?Userid)
        {
            if (Userid != null)
            {
                ViewBag.UserId = Userid;
            }
            try
            {
                ParticipantsDetailModel model = new ParticipantsDetailModel();
                model.Participantregistration = new List <ParticipationRegistrationModel>();
                var data1  = new BasicFunctionalityofentireappService();
                var result = data1.GetTotalVoteperPost(SessionToken).Entity;
                model.voterslist = new List <VotesModel>();
                model.voterslist = result;

                using (var db = new ConquerorHubEntities())

                {
                    Dictionary <int, Guid?> dict = new Dictionary <int, Guid?>();
                    var data4 = db.CH_ParticipantRegistration.Where(f => f.ParticipantId == Userid.ToString()).Select(f => f).ToList();
                    foreach (var item in data4)
                    {
                        var count = db.CH_VoteTable.GroupBy(a => a.EventId == item.EventId && a.PostId == item.ParticipantsPostId && a.VoteStatus == true).Select(a => a).Count();
                        if (count != 0)
                        {
                            dict.Add(count, item.ParticipantsPostId);
                            dict.OrderByDescending(x => x.Key);
                        }
                    }

                    if (dict.Count != 0)
                    {
                        var values = dict.Take(3).ToDictionary(x => x.Value).Values;

                        var data01 = new List <ParticipationRegistrationModel>();

                        var data0 = new List <CH_ParticipantRegistration>();
                        foreach (var item in values)
                        {
                            data0 = db.CH_ParticipantRegistration.Where(d => d.ParticipantsPostId == item.Value.Value).Select(d => d).ToList();
                        }

                        foreach (var item in data0)
                        {
                            model.Participantregistration = new List <ParticipationRegistrationModel>();
                            model.Participantregistration.Add(new ParticipationRegistrationModel()
                            {
                                Data            = item.Data,
                                OrganizerId     = item.OrganizerId,
                                ParticipantId   = item.ParticipantId,
                                EventId         = item.EventId,
                                VideoId         = item.ParticipantsPostId,
                                Name            = item.Name,
                                Qualification   = item.Qualification,
                                CollegeorSchool = item.CollegeorSchool,
                            });
                        }
                    }
                    model.aboutEventlist        = new List <AboutEvent>();
                    model.aboutParticipantslist = new List <AboutParticipants>();
                    model.importantDateslist    = new List <ImportantDates>();
                    model.awardRewardlist       = new List <AwardsAndRewards>();
                    EventsServices serviceObj = new EventsServices();

                    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();
                    model.aboutEventlist.AddRange(Aboutevent);
                    model.aboutParticipantslist.AddRange(Aboutparticipant);
                    model.importantDateslist.AddRange(impdates);
                    model.awardRewardlist.AddRange(AwardReward);
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
        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> PastEventsPerformance(Guid?Userid, Guid?EventId)
        {
            if (Userid != null)
            {
                ViewBag.UserId = Userid;
            }
            else
            {
                Userid = Guid.Parse(User.Identity.GetUserId());
            }

            ParticipantsDetailModel model = new ParticipantsDetailModel();

            model.Participantregistration = new List <ParticipationRegistrationModel>();
            var data1  = new BasicFunctionalityofentireappService();
            var result = data1.GetTotalVoteperPost(SessionToken).Entity;

            model.voterslist = new List <VotesModel>();


            model.aboutEventlist        = new List <AboutEvent>();
            model.aboutParticipantslist = new List <AboutParticipants>();
            model.importantDateslist    = new List <ImportantDates>();
            model.awardRewardlist       = new List <AwardsAndRewards>();
            EventsServices serviceObj = new EventsServices();

            try
            {
                var Aboutevent       = serviceObj.GetRegistrationAboutEvent(SessionToken, Userid).Entity.Where(x => x.EventStatus == 5).ToList();
                var Aboutparticipant = serviceObj.GetORegistrtionAboutParticipant(SessionToken, Userid).Entity.Where(x => x.EventStatus == 5).ToList();
                var AwardReward      = serviceObj.GetAwardAndReward(SessionToken, Userid).Entity.Where(x => x.EventStatus == 5).ToList();
                var impdates         = serviceObj.GetImportantDateAndTime(SessionToken, Userid).Entity.Where(x => x.EventStatus == 5).ToList();
                model.aboutEventlist.AddRange(Aboutevent);
                model.aboutParticipantslist.AddRange(Aboutparticipant);
                model.importantDateslist.AddRange(impdates);
                model.awardRewardlist.AddRange(AwardReward);
                var eventid = Aboutevent.Select(x => x.EventId);
                OrganiserBasicDetailsServices obj1 = new OrganiserBasicDetailsServices();
                var data  = new List <ParticipationRegistrationModel>();
                var data2 = await obj1.GetParticipantRegistration(SessionToken);

                data.AddRange(data2.Where(x => x.OrganizerId == Userid.ToString() && x.EventId == EventId).Select(x => x).ToList());
                var ImageorVideo1 = await obj1.GetEventRegistrationImageVideo(SessionToken);

                var ImageorVideo = ImageorVideo1.Where(x => x.Imagevideo.EventIdImageorVideo == EventId).Select(x => x.Imagevideo.imageorvideo).FirstOrDefault();

                model.Participantregistration = new List <ParticipationRegistrationModel>();
                if (data.Count() != 0)
                {
                    foreach (var item in data)
                    {
                        model.Participantregistration.Add(new ParticipationRegistrationModel()
                        {
                            Data            = ImageorVideo == 2 ? item.Data : null,
                            Images          = ImageorVideo == 1 ? 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,
                            ContentType     = item.ContentType,
                        });
                    }
                }



                return(View(model));
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }