public async Task <Guid> SaveParticipantGalleryVideo(string sessionToken, GalleryViewModel model)
        {
            var data1 = 0;

            using (var db = new ConquerorHubEntities())
            {
                var result = new CH_ParticipantsGallery()
                {
                    Id          = model.GalleryData.Id,
                    ImageData   = model.GalleryData.ImageData,
                    Caption     = model.GalleryData.Caption,
                    UserId      = model.GalleryData.UserId,
                    PostId      = model.GalleryData.PostId,
                    VideoData   = model.GalleryData.VideoData,
                    ContentType = model.GalleryData.ContentType,
                    DateAndTime = DateTime.UtcNow,
                    FileName    = Path.GetFileName(model.GalleryData.UploadedPost.FileName)
                };


                try
                {
                    db.CH_ParticipantsGallery.Add(result);

                    data1 = db.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(await Task.FromResult(Guid.NewGuid()));
            }
        }
        public async Task <List <EventRegistrationfromOrganizerModel> > GetEventRegistrationImageVideo(string sessionToken)
        {
            using (var db = new ConquerorHubEntities())
            {
                try
                {
                    var result = (from details in db.CH_EventRegistrationFromOrganizer


                                  select new EventRegistrationfromOrganizerModel()
                    {
                        Imagevideo = new EventsImageandVideo()
                        {
                            EventIdImageorVideo = details.EventId,
                            OrganizerId = details.OrganizerId,
                            EventImage = details.EventImage,
                            EventVideo = details.EventVideo,
                            imageorvideo = details.ImageorVideoforEvent,
                            Homedisplayevent = details.Eventdisplayonhomepage,
                            EventStatus = details.EventStatus,
                            EventMode = details.modeofevent,
                            Datetime = details.CurrentDateandTime
                        }
                    }).ToList();
                    return(await Task.FromResult(result));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public async Task <Guid> SaveEventRegistrationImageVideo(string sessionToken, EventRegistrationfromOrganizerModel model)
        {
            using (var db = new ConquerorHubEntities())
            {
                try
                {
                    var data = db.CH_EventRegistrationFromOrganizer.Where(x => x.OrganizerId == model.Imagevideo.OrganizerId && x.EventId == model.Imagevideo.EventIdImageorVideo).Select(x => x).FirstOrDefault();
                    data.EventImage = model.Imagevideo.EventImage;
                    data.EventVideo = model.Imagevideo.EventVideo;
                    try
                    {
                        db.Entry(data).State = EntityState.Modified;

                        db.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    return(await Task.FromResult(Guid.NewGuid()));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public async Task <List <GalleryModel> > GetParticipantGallerydata(string sessionToken)
        {
            using (var db = new ConquerorHubEntities())
            {
                var userId = db.SessionTokens.Where(a => a.SessionToken1 == sessionToken).SingleOrDefault().UserId;
                try
                {
                    var result = (from details in db.CH_ParticipantsGallery


                                  select new GalleryModel()
                    {
                        Id = details.Id,
                        ImageData = details.ImageData,
                        Caption = details.Caption,
                        UserId = details.UserId,
                        PostId = details.PostId,
                        VideoData = details.VideoData,
                        ContentType = details.ContentType,
                        FileName = details.FileName,
                        DateAndTime = details.DateAndTime
                    }).ToList();
                    return(await Task.FromResult(result));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public async Task <List <ParticipationRegistrationModel> > GetParticipantRegistration(string sessionToken)
        {
            using (var db = new ConquerorHubEntities())
            {
                try
                {
                    var result = (from details in db.CH_ParticipantRegistration


                                  select new ParticipationRegistrationModel()
                    {
                        Data = details.Data,

                        OrganizerId = details.OrganizerId,
                        ParticipantId = details.ParticipantId,
                        EventId = details.EventId,
                        VideoId = details.ParticipantsPostId,
                        Name = details.Name,
                        Qualification = details.Qualification,
                        CollegeorSchool = details.CollegeorSchool,
                        ContentType = details.ContentType,
                        ParticipantStatus = details.ParticipantStatus,
                        ContactNumber = details.ContactNumber,
                        About_Self = details.About_Self,
                        Modeofcompitetion = (modeofcompetation)details.Modeofcompitetion
                    }).ToList();
                    return(await Task.FromResult(result));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public async Task <List <Home> > GetHomePage(string sessionToken)
        {
            using (var db = new ConquerorHubEntities())
            {
                var userId = db.SessionTokens.Where(a => a.SessionToken1 == sessionToken).SingleOrDefault().UserId;
                try
                {
                    var result = (from details in db.CH_HomePageData


                                  select new Home()
                    {
                        Id = details.Id,
                        Image = details.Image,
                        Video = details.Video,
                        Postid = details.Postid,
                        PostText = details.PostText,
                        UserId = details.UserId,
                        DateTime = details.DateTime
                    }).ToList();
                    return(await Task.FromResult(result));
                }
                catch (Exception)
                {
                    throw new Exception("Error getting image");
                }
            }
        }
        public async Task <List <ParticipationRegistrationModel> > GetParticipantData(string sessionToken)
        {
            using (var db = new ConquerorHubEntities())
            {
                var userId = db.SessionTokens.Where(a => a.SessionToken1 == sessionToken).SingleOrDefault().UserId;
                try
                {
                    var result = (from details in db.CH_ParticipantRegistration


                                  select new ParticipationRegistrationModel()
                    {
                        Data = details.Data,

                        OrganizerId = details.OrganizerId,
                        ParticipantId = details.ParticipantId,
                        EventId = details.EventId,
                        VideoId = details.ParticipantsPostId,
                        Name = details.Name,
                        Qualification = details.Qualification,
                        CollegeorSchool = details.CollegeorSchool,
                    }).ToList();
                    return(await Task.FromResult(result));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public async Task <LastLoginModel> GetLastLogindb(string UserId)
        {
            using (var db = new ConquerorHubEntities())
            {
                try
                {
                    var result = (from details in db.CH_LastLogin
                                  where details.UserId == UserId

                                  select new LastLoginModel()
                    {
                        Id = details.Id,
                        UserId = details.UserId,
                        ExpiryDateTime = details.ExpiryDateTime,
                        CreatedDateandTime = details.CreatedDateandTime,
                        SessionToken = details.SessionToken,
                    }).FirstOrDefault();
                    return(await Task.FromResult(result));
                }
                catch (Exception)
                {
                    throw new Exception("Error getting sponsors");
                }
            }
        }
Пример #9
0
        public FileResult DownloadFile1(byte[] data)
        {
            var result = new CH_EventRegistrationFromOrganizer();

            using (var db = new ConquerorHubEntities())
            {
                result = db.CH_EventRegistrationFromOrganizer.ToList().Find(x => x.EventVideo == data);
            }
            return(File(result.EventVideo, "video"));
        }
Пример #10
0
        public ActionResult SaveShare(Guid?id, string sourceid)
        {
            string extension = "";

            ShareModel model = new ShareModel();

            try
            {
                using (var db = new ConquerorHubEntities())

                {
                    var datatype = db.CH_ParticipantRegistration.Where(x => x.ParticipantsPostId == id).Select(x => x.ContentType).FirstOrDefault();
                    if (datatype != null)
                    {
                        extension = datatype.Split('.').Last();
                    }
                    var type = db.CH_ParticipantsGallery.Where(x => x.PostId == id).Select(x => x.ContentType).FirstOrDefault();
                    if (type != null)
                    {
                        extension = type.Split('.').Last();
                    }
                }

                if (sourceid == "")
                {
                    model.SourcePage = User.Identity.GetUserId();
                }
                else
                {
                    model.SourcePage = sourceid;
                }


                model.ContentType     = extension;
                model.DestinationPage = User.Identity.GetUserId();
                model.PostId          = id;
                var value = data.SaveShare(SessionToken, model);

                return(Json(value, JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)
            {
                return(View("~/Views/Errorpage/Errorpage.cshtml"));
            }
        }
        public async Task <Guid> PostHome(CH_HomeViewModel model)
        {
            if (model != null)
            {
                if (model.homeSingledata.Image1 != null)
                {
                    MemoryStream target1 = new MemoryStream();
                    model.homeSingledata.Image1.InputStream.CopyTo(target1);
                    byte[] Photo = target1.ToArray();
                    model.homeSingledata.Image = Photo;
                    target1.Close();
                }
                using (var db = new ConquerorHubEntities())
                {
                    var data = new CH_HomePageData()
                    {
                        Id       = model.homeSingledata.Id,
                        UserId   = model.homeSingledata.UserId,
                        DateTime = DateTime.UtcNow,
                        Postid   = model.homeSingledata.Postid,
                        Image    = model.homeSingledata.Image,
                        Video    = model.homeSingledata.Video,
                        PostText = model.homeSingledata.PostText,
                    };
                    try
                    {
                        db.CH_HomePageData.Add(data);

                        db.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                }
            }
            return(await Task.FromResult(Guid.NewGuid()));
        }
Пример #12
0
        public JsonResult Searchbox()
        {
            var           data1     = new List <AspnetUsersModel>();
            List <string> EmailList = new List <string>();

            try
            {
                var data11 = new ConquerorHubEntities().AspNetUsers.Select(x => new AspnetUsersModel()
                {
                    Id = x.Id, Email = x.Email, UserName = x.UserName, UserActive = x.UserActive
                }).ToList();
                Session["UserData"] = data11;
                foreach (var i in data11)
                {
                    EmailList.Add(i.Email);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Json(EmailList, JsonRequestBehavior.AllowGet));
        }
        public async Task <string> SavePerformanceFromparticipants(string sessionToken, ParticipationRegistrationModel model)
        {
            using (var db = new ConquerorHubEntities())
            {
                try
                {
                    var data1        = 0;
                    var ImageorVideo = db.CH_EventRegistrationFromOrganizer.Where(x => x.EventId == model.EventId).Select(x => x.ImageorVideoforEvent).FirstOrDefault();
                    var data         = db.CH_ParticipantRegistration.Where(x => x.OrganizerId == model.OrganizerId && x.EventId == model.EventId).Count();
                    var model2       = db.CH_ParticipantRegistration.Where(x => x.OrganizerId == model.OrganizerId && x.EventId == model.EventId).FirstOrDefault();
                    if (ImageorVideo == 2)
                    {
                        byte[] bytes1;
                        using (BinaryReader br = new BinaryReader(model.PostedFile.InputStream))
                        {
                            bytes1 = br.ReadBytes(model.PostedFile.ContentLength);
                        }
                        if (data > 0)
                        {
                            model2.ContentType        = Path.GetFileName(model.PostedFile.FileName);
                            model2.FileName           = Path.GetFileName(model.PostedFile.FileName);
                            model2.Data               = bytes1;
                            model2.ParticipantsPostId = Guid.NewGuid();
                            model2.ParticipantStatus  = 2;
                        }
                        try
                        {
                            db.Entry(model2).State = EntityState.Modified;

                            data1 = db.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }


                        if (data1 == 1)
                        {
                            return(await Task.FromResult("Your Video is uploaded you'll get email if you are shortlisted"));
                        }
                    }
                    else if (ImageorVideo == 1)
                    {
                        if (model.PostedFile != null)
                        {
                            MemoryStream target1 = new MemoryStream();
                            model.PostedFile.InputStream.CopyTo(target1);
                            byte[] Photo = target1.ToArray();
                            model.Data = Photo;
                            target1.Close();
                        }
                        if (data > 0)
                        {
                            model2.ContentType        = Path.GetFileName(model.PostedFile.FileName);
                            model2.FileName           = Path.GetFileName(model.PostedFile.FileName);
                            model2.Data               = model.Data;
                            model2.ParticipantsPostId = Guid.NewGuid();
                            model2.ParticipantStatus  = 2;
                        }
                        try
                        {
                            db.Entry(model2).State = EntityState.Modified;

                            data1 = db.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }


                        if (data1 == 1)
                        {
                            return(await Task.FromResult("Your Image is uploaded you'll get email if you are shortlisted"));
                        }
                    }
                    try
                    {
                        db.Entry(model2).State = EntityState.Modified;

                        db.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(await Task.FromResult(""));
            }
        }
Пример #14
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;
            }
        }
Пример #15
0
        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"));
            }
        }
Пример #16
0
        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"));
            }
        }