public ActionResult ParticipantVideoGallery(GalleryViewModel model)
        {
            byte[] bytes1;
            using (BinaryReader br = new BinaryReader(model.GalleryData.UploadedPost.InputStream))
            {
                bytes1 = br.ReadBytes(model.GalleryData.UploadedPost.ContentLength);
            }
            try {
                model.GalleryData.PostId = Guid.NewGuid();
                model.GalleryData.UserId = User.Identity.GetUserId();
                model.GalleryData.Id     = Guid.NewGuid();
                var    filename  = Path.GetFileName(model.GalleryData.UploadedPost.FileName);
                string extension = filename.Split('.').Last();
                model.GalleryData.VideoData   = bytes1;
                model.GalleryData.ContentType = extension;

                OrganiserBasicDetailsServices organizerBasicdetail = new OrganiserBasicDetailsServices();
                var result = organizerBasicdetail.SaveParticipantGalleryVideo(SessionToken, model);
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }

            return(RedirectToAction("ParticipantVideoGallery", "Participants"));
        }
        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 async Task <ActionResult> SaveOngoingEventParticipant(ParticipationRegistrationModel model)
        {
            model.ParticipantId = User.Identity.GetUserId();

            OrganiserBasicDetailsServices obj = new OrganiserBasicDetailsServices();
            string data = await obj.SavePerformanceFromparticipants(SessionToken, model);

            TempData["msg"] = data;

            return(RedirectToAction("Uploadvideo", new { Eventid = model.EventId, OrganizerId = model.OrganizerId }));
        }
        public async Task <ActionResult> ShortlistedParticipants(Guid?Eventid, Guid?Userid)
        {
            if (Userid != null)
            {
                ViewBag.UserId = Userid;
            }
            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;
            Random rnd = new Random();
            OrganiserBasicDetailsServices service = new OrganiserBasicDetailsServices();
            var participantRegistration           = await service.GetParticipantRegistration(SessionToken);

            var data          = participantRegistration.Where(x => x.ContentType != null && x.EventId == Eventid && x.ParticipantStatus == 3).Select(x => x).OrderBy(x => Guid.NewGuid()).ToList();
            var ImageorVideo1 = await service.GetEventRegistrationImageVideo(SessionToken);

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

            try
            {
                foreach (var item in data)
                {
                    model.Participantregistration.Add(new ParticipationRegistrationModel()
                    {
                        OrganizerId       = item.OrganizerId,
                        EventId           = item.EventId,
                        CollegeorSchool   = item.CollegeorSchool,
                        ContentType       = item.ContentType,
                        About_Self        = item.About_Self,
                        DateOfBirthh      = item.DateOfBirthh,
                        Data              = ImageorVideo == 2 ? item.Data : null,
                        Images            = ImageorVideo == 1 ? Imageget(item.Data) : null,
                        ContactNumber     = item.ContactNumber,
                        FileName          = item.FileName,
                        Modeofcompitetion = (modeofcompetation)item.Modeofcompitetion,
                        VideoId           = item.VideoId,
                        Name              = item.Name,
                        Qualification     = item.Qualification,
                    });
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
        public async Task <ActionResult> RegisteredParticipantsfortheevent(Guid EventId)
        {
            ParticipantsDetailModel model = new ParticipantsDetailModel();

            model.Participantregistration = new List <ParticipationRegistrationModel>();
            OrganiserBasicDetailsServices obj = new OrganiserBasicDetailsServices();

            var Eventdetails1 = await obj.GetEventRegistrationImageVideo(SessionToken);

            var Eventdetails = Eventdetails1.Where(x => x.Imagevideo.EventIdImageorVideo == EventId).Select(x => x).FirstOrDefault();

            ViewBag.EventMode = Eventdetails.Imagevideo.EventMode;
            var data1 = await obj.GetParticipantRegistration(SessionToken);

            var data = data1.Where(x => x.EventId == EventId).Select(x => x).ToList();

            try
            {
                foreach (var item in data)
                {
                    model.Participantregistration.Add(new ParticipationRegistrationModel()
                    {
                        ParticipantId   = item.ParticipantId,
                        OrganizerId     = item.OrganizerId,
                        EventId         = item.EventId,
                        CollegeorSchool = item.CollegeorSchool,
                        ContentType     = item.ContentType,
                        About_Self      = item.About_Self,

                        Data              = Eventdetails.Imagevideo.imageorvideo == 2 && item.Data != null ? item.Data : null,
                        Images            = Eventdetails.Imagevideo.imageorvideo == 1 && item.Data != null ? Imageget(item.Data) : null,
                        ContactNumber     = item.ContactNumber,
                        FileName          = item.FileName,
                        Modeofcompitetion = (modeofcompetation)item.Modeofcompitetion,
                        VideoId           = item.VideoId,
                        Name              = item.Name,
                        Qualification     = item.Qualification,
                    });
                }



                return(View(model));
            }
            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
        public async Task <FileResult> DownloadFile(Guid?VideoID, Guid?EventId)
        {
            var basicfunctionality = new OrganiserBasicDetailsServices();
            var result             = new List <ParticipationRegistrationModel>();

            try
            {
                result = await basicfunctionality.GetParticipantRegistration(SessionToken);

                var data = result.ToList().Find(x => x.VideoId == VideoID);

                return(File(data.Data, data.ContentType, data.FileName));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <FileResult> DownloadFile1(Guid?EventId)
        {
            var basicfunctionality = new OrganiserBasicDetailsServices();
            var result             = new List <EventRegistrationfromOrganizerModel>();

            try
            {
                result = await basicfunctionality.GetEventRegistrationImageVideo(SessionToken);

                var data = result.ToList().Find(x => x.Imagevideo.EventIdImageorVideo == EventId);

                return(File(data.Imagevideo.EventVideo, "Video", "Video"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <FileResult> DownloadFile1(Guid?VideoID)
        {
            var result = new GalleryModel();

            try
            {
                OrganiserBasicDetailsServices obj1 = new OrganiserBasicDetailsServices();
                var result1 = await obj1.GetParticipantGallerydata(SessionToken);

                result = result1.ToList().Find(x => x.PostId == VideoID);

                return(File(result.VideoData, result.ContentType, result.FileName));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #9
0
        public async Task <ActionResult> GetNotificationpost(Guid?postid, string sourceId)
        {
            //From Sponsor Page
            var services = new OrganiserBasicDetailsServices();
            NotificationPostModel notificationPost = new NotificationPostModel();

            notificationPost.sourceID = sourceId;
            notificationPost.PostId   = postid;
            var sponsorList = services.GetSponsorList(SessionToken, Guid.Parse(User.Identity.GetUserId())).Entity;

            if (sponsorList != null)
            {
                var notifiedSponsorPost = sponsorList.Where(x => x.ImageId == postid).Select(x => x.Image).FirstOrDefault();
                if (notifiedSponsorPost != null)
                {
                    notificationPost.Image = Imageget(notifiedSponsorPost);
                }
            }
            //From Gallery Page of Participants
            var galleryList = await services.GetParticipantGallerydata(SessionToken);

            if (galleryList != null)
            {
                var filteredGallery = galleryList.FirstOrDefault(x => x.PostId == postid);

                notificationPost.Image = filteredGallery == null ? null : Imageget(filteredGallery.ImageData);
                notificationPost.Video = filteredGallery == null ? null : filteredGallery.VideoData;
            }
            //Participation post
            var participantPost = await services.GetParticipantRegistration(SessionToken);

            if (participantPost != null)
            {
                var filteredParticiapnts = participantPost.FirstOrDefault(x => x.VideoId == postid && x.OrganizerId == User.Identity.GetUserId());
                var eventImageorVideo    = await services.GetEventRegistrationImageVideo(SessionToken);

                if (filteredParticiapnts != null)
                {
                    var ImageorVideo = eventImageorVideo == null ? null : eventImageorVideo.Where(x => x.Imagevideo.EventIdImageorVideo == filteredParticiapnts.EventId).Select(x => x.Imagevideo.imageorvideo).FirstOrDefault();
                    if (ImageorVideo == 1)
                    {
                        notificationPost.Image = filteredParticiapnts == null ? null : Imageget(filteredParticiapnts.Data);
                    }
                    else if (ImageorVideo == 2)
                    {
                        notificationPost.Video = filteredParticiapnts == null ? null : filteredParticiapnts.Data;
                    }
                }
            }
            //Home post
            var homeList = await services.GetHomePage(SessionToken);

            if (homeList != null)
            {
                notificationPost.PostId = postid;
                var homePost = homeList.FirstOrDefault(x => x.Postid == postid && x.UserId == User.Identity.GetUserId());
                if (homePost != null)
                {
                    if (homePost.Image != null)
                    {
                        notificationPost.Image = Imageget(homePost.Image);
                    }
                    if (homePost.Video != null)
                    {
                        notificationPost.Video = homePost.Video;
                    }
                }
            }
            ViewBag.LikeCount    = data.GetTotalLikesOfPost(SessionToken).Entity == null ? 0 : data.GetTotalLikesOfPost(SessionToken).Entity.Where(x => x.Imageid == postid && x.DestinationUserId == User.Identity.GetUserId() && x.LikeStatus == true).Select(x => x).Count();
            ViewBag.DislikeCount = data.GetTotalLikesOfPost(SessionToken).Entity.Where(x => x.Imageid == postid && x.DestinationUserId == User.Identity.GetUserId() && x.LikeStatus == false).Select(x => x).Count();
            ViewBag.commentCount = data.GetcommentCount(SessionToken).Entity.Where(x => x.PostId == postid && x.DestinationUserId == User.Identity.GetUserId()).Select(x => x).Count();
            return(View(notificationPost));
        }
        public async Task <ActionResult> OrganizeEvent(EventRegistrationfromOrganizerModel model, string status)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            try
            {
                OrganiserBasicDetailsServices services = new OrganiserBasicDetailsServices();
                var            eventid = Guid.Empty;
                EventsServices obj     = new EventsServices();
                tabopen        openTab = new tabopen();
                if (model.aboutEvent != null)
                {
                    if (model.aboutEvent.NameofOrganizer != null)
                    {
                        model.aboutEvent.EventId = Guid.NewGuid();

                        model.aboutEvent.OrganizerId = User.Identity.GetUserId();
                        Session["Eventid"]           = model.aboutEvent.EventId;

                        var AboutEventTab = obj.SaveRegistrationAboutEvent(SessionToken, model).Entity;
                        openTab.Default       = false;
                        openTab.AboutEvent    = true;
                        ViewBag.AboutEventTab = AboutEventTab.Result;
                        eventid = AboutEventTab.Result;
                    }
                }
                if (model.aboutParticipants != null)
                {
                    model.aboutParticipants.OrganizerId = User.Identity.GetUserId();
                    model.aboutParticipants.EventId     = (Guid)Session["Eventid"];

                    var eventParticipant = obj.SaveORegistrtionAboutParticipant(SessionToken, model).Entity;
                    openTab.AboutParticipant    = true;
                    openTab.Default             = false;
                    ViewBag.EvantParticipanttab = eventParticipant.Result;
                    eventid = eventParticipant.Result;
                }
                if (model.importantDates != null)
                {
                    model.importantDates.OrganizerId = User.Identity.GetUserId();;
                    model.importantDates.EventId     = (Guid)Session["Eventid"];
                    var importantDates = obj.SaveImportantDateAndTime(SessionToken, model);
                    ViewBag.ImportantDates = importantDates.Entity.Result;
                    openTab.Default        = false;
                    openTab.Imortantdates  = true;
                    eventid = importantDates.Entity.Result;
                }
                if (model.awardReward != null)
                {
                    model.awardReward.OrganizerId = User.Identity.GetUserId();;


                    model.awardReward.EventId = (Guid)Session["Eventid"];
                    var AwardReward = obj.SaveAwardAndReward(SessionToken, model).Entity;
                    ViewBag.AwardandReward = AwardReward.Result;
                    openTab.Default        = false;
                    openTab.Awarcreward    = true;
                    eventid = AwardReward.Result;
                }
                if (status != null)
                {
                    using (var db = new ConquerorHubEntities())
                    {
                        CH_EventRegistrationFromOrganizer data = db.CH_EventRegistrationFromOrganizer.Where(x => x.OrganizerId == model.Imagevideo.OrganizerId && x.EventId == model.Imagevideo.EventIdImageorVideo).Select(x => x).FirstOrDefault();
                        if (status == "yes")
                        {
                            data.Eventdisplayonhomepage = true;
                        }
                        else
                        {
                            data.Eventdisplayonhomepage = false;
                        }
                    }
                }
                if (model.Imagevideo != null)
                {
                    model.Imagevideo.OrganizerId         = User.Identity.GetUserId();
                    model.Imagevideo.EventIdImageorVideo = (Guid)Session["Eventid"];
                    openTab.EventVideoImage = true;
                    //openTab.AvoidDefault = true;
                    var user1 = await services.GetEventRegistrationImageVideo(SessionToken);

                    var user = user1.Where(x => x.Imagevideo.OrganizerId == model.Imagevideo.OrganizerId && x.Imagevideo.EventIdImageorVideo == model.Imagevideo.EventIdImageorVideo).Count();

                    if (model.Imagevideo.PostedImage != null)
                    {
                        MemoryStream target1 = new MemoryStream();
                        model.Imagevideo.PostedImage.InputStream.CopyTo(target1);
                        byte[] Photo = target1.ToArray();
                        model.Imagevideo.EventImage = Photo;
                        target1.Close();
                    }
                    if (user == 1)
                    {
                        byte[] bytes1;
                        using (BinaryReader br = new BinaryReader(model.Imagevideo.PostedVideo.InputStream))
                        {
                            bytes1 = br.ReadBytes(model.Imagevideo.PostedVideo.ContentLength);
                        }
                        var data = user1.Where(x => x.Imagevideo.OrganizerId == model.Imagevideo.OrganizerId && x.Imagevideo.EventIdImageorVideo == model.Imagevideo.EventIdImageorVideo).Select(x => x).FirstOrDefault();
                        EventRegistrationfromOrganizerModel detail = new EventRegistrationfromOrganizerModel();
                        detail.Imagevideo                     = new EventsImageandVideo();
                        detail.Imagevideo.EventImage          = model.Imagevideo.EventImage;
                        detail.Imagevideo.EventVideo          = bytes1;
                        detail.Imagevideo.EventIdImageorVideo = model.Imagevideo.EventIdImageorVideo;
                        detail.Imagevideo.OrganizerId         = model.Imagevideo.OrganizerId;
                        await services.SaveEventRegistrationImageVideo(SessionToken, detail);
                    }
                }



                TempData["opentab"] = openTab;

                return(RedirectToAction("OrganizeEvent", new { eventid = Session["Eventid"] }));
            }
            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"));
            }
        }
        public async Task <ActionResult> ParticipantVideoGallery(Guid?Userid)
        {
            var obj   = new GalleryViewModel();
            var model = new List <GalleryModel>();
            var data  = new List <GalleryModel>();

            try
            {
                var user = "";
                if (Userid == null)
                {
                    user = User.Identity.GetUserId();
                }
                if (Userid != null)
                {
                    ViewBag.UserId = Userid;
                    user           = Userid.ToString();
                }

                OrganiserBasicDetailsServices obj1 = new OrganiserBasicDetailsServices();



                if (user != null)
                {
                    var model1 = await obj1.GetParticipantGallerydata(SessionToken);

                    model = model1.Where(x => x.UserId == user).Select(x => x).ToList();


                    foreach (var item in model)
                    {
                        if (item.VideoData != null)
                        {
                            data.Add(new GalleryModel()
                            {
                                Id          = item.Id,
                                ImageData   = item.ImageData,
                                Caption     = item.Caption,
                                UserId      = item.UserId,
                                PostId      = item.PostId,
                                VideoData   = item.VideoData,
                                ContentType = item.ContentType
                            });
                        }
                    }
                }
                obj.GalleryList = new List <GalleryModel>();
                obj.GalleryList.AddRange(data);
                obj.GalleryData = new GalleryModel();
                obj.likesdata   = new List <LikesModel>();
                var data2   = new BasicFunctionalityofentireappService();
                var rsult   = data2.GetTotalLikesOfPost(SessionToken).Entity;
                var comment = data2.GetcommentCount(SessionToken).Entity;
                obj.commentData = new List <CommentModel>();
                obj.commentData.AddRange(comment);

                obj.likesdata.AddRange(rsult);
                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 ParticipantsController()
 {
     services = new OrganiserBasicDetailsServices();
 }
 public OrganizerBasicDetailsController()
 {
     services = new OrganiserBasicDetailsServices();
 }