public JsonResult OylamamiGetir(Guid oylamaId)
        {
            VotedressUser user = new VotedressUser();

            user = Session["login"] as VotedressUser;


            OylamaManager oylamaManager = new OylamaManager();
            Vote_sade     vote_Sade     = oylamaManager.OylamaGetir(oylamaId, user.id);


            return(Json(vote_Sade, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Oylamalarim()
        {
            VotedressUser user = new VotedressUser();

            user = Session["login"] as VotedressUser;

            OylamaManager        oylamaManager        = new OylamaManager();
            OylamalarimViewModel oylamalarimViewModel = new OylamalarimViewModel();

            oylamalarimViewModel = oylamaManager.OylamalarimSayfasi(user.id);

            return(View(oylamalarimViewModel));
        }
        public ActionResult OylamaBaslat(string oylama_suresi, bool paylasima_acikmi, bool kimlik_durumu, string oylama_tipi, string urun_1, string urun_2, string urun_3, string urun_aciklamasi_1_1, string urun_aciklamasi_1_2, string urun_aciklamasi_1_3, string urun_aciklamasi_2_1, string urun_aciklamasi_2_2, string urun_aciklamasi_2_3, string urun_aciklamasi_3_1, string urun_aciklamasi_3_2, string urun_aciklamasi_3_3)
        {
            VotedressUser user = new VotedressUser();

            user = Session["login"] as VotedressUser;

            OylamaManager oylama_manager = new OylamaManager();

            bool sonuc = oylama_manager.OylamaEkle(user.id, oylama_suresi, oylama_tipi, paylasima_acikmi, kimlik_durumu, Request.Files, urun_1, urun_2, urun_3, urun_aciklamasi_1_1, urun_aciklamasi_1_2, urun_aciklamasi_1_3, urun_aciklamasi_2_1, urun_aciklamasi_2_2, urun_aciklamasi_2_3, urun_aciklamasi_3_1, urun_aciklamasi_3_2, urun_aciklamasi_3_3);


            if (sonuc == true)
            {
                return(RedirectToAction("Oylamalarim", "Profile"));
            }

            return(RedirectToAction("OylamaBaslatilamadi"));
        }
        public JsonResult Oyla(int id)
        {
            VotedressUser user = new VotedressUser();

            user = Session["login"] as VotedressUser;

            OylamaManager oylama_manager = new OylamaManager();

            bool sonuc = oylama_manager.Oyla(user, id);

            if (sonuc == true)
            {
                Vote_sade yeni_oylama = oylama_manager.OylamaGetirOylamakIcin(user.id);

                return(Json(new { YeniOylama = yeni_oylama, IsSuccess = true, Message = "Oylama Başarılı" }, JsonRequestBehavior.AllowGet));
            }


            return(Json(new { IsSuccess = false, Message = "Oylama Başarısız" }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index()
        {
            VotedressUser user = new VotedressUser();

            user = Session["login"] as VotedressUser;

            OylamaManager vote_manager = new OylamaManager();
            Vote_sade     oylama       = vote_manager.OylamaGetirOylamakIcin(user.id);

            if (oylama != null)
            {
                InVoteChatManager invoteChatManager = new InVoteChatManager();
                if (invoteChatManager.Chattemiyim(user.id, oylama.id) == null)
                {
                    VotedressUserDetailManager userdetail_Manager = new VotedressUserDetailManager();
                    UserDetail kullanici_detayi = new UserDetail();
                    kullanici_detayi = userdetail_Manager.GetUserDetail(user.id);
                    VotedressUser_sade sade_kullanici = new VotedressUser_sade()
                    {
                        id           = kullanici_detayi.UserId,
                        SocialId     = kullanici_detayi.User.SocialId,
                        SocialName   = kullanici_detayi.User.SocialName,
                        Name         = kullanici_detayi.Name,
                        SurName      = kullanici_detayi.SurName,
                        Birthday     = kullanici_detayi.Birthday,
                        Email        = kullanici_detayi.User.Email,
                        ProfileImage = kullanici_detayi.User.ProfileImage,
                        Sex          = kullanici_detayi.Sex,
                    };
                    InVoteChatManager repo_invotechatManager = new InVoteChatManager();
                    repo_invotechatManager.AddUserChat(user.id, oylama.id);
                }
            }
            else
            {
                return(View(oylama));//Oylama yok sayfasına yönlerdircen
            }
            return(View(oylama));
        }
        public ActionResult UrunDetayliIncele(Guid id)
        {
            ProductManager productManager = new ProductManager();
            Product        urun           = productManager.UrunGetir(id);

            int commentCount = urun.ProductComment.Count;

            for (int i = 0; i < urun.ProductComment.Count; i++)
            {
                commentCount = commentCount + urun.ProductComment[i].ProductCommentReply.Count();
            }


            SocialShareManager socialShareManager = new SocialShareManager();
            List <SocialShare> urunPaylasimi      = socialShareManager.UrunPaylasimlariniGetir(id);

            OylamaManager oylamaMnager         = new OylamaManager();
            int           urunluOylamalarCount = oylamaMnager.UrunluOylamalariGetir(id).Count();


            int facebookShareCount  = urunPaylasimi.Where(x => x.SocialName == "facebook").Count();
            int instagramShareCount = urunPaylasimi.Where(x => x.SocialName == "instagram").Count();
            int twitterShareCount   = urunPaylasimi.Where(x => x.SocialName == "twitter").Count();
            int votedressShareCount = urunPaylasimi.Where(x => x.SocialName == "votedress").Count();


            var JsonModel = new
            {
                urun = new
                {
                    id           = urun.id,
                    productName  = urun.ProductName,
                    productImage = urun.ProductImage,
                    Collections  = urun.ProductCollection.Select(k => new
                    {
                        id             = k.Collection.id,
                        collectionName = k.Collection.CollectionName,
                        description    = k.Collection.Description,
                        createDate     = k.Collection.CreateDate,
                    }),
                    price            = urun.Price,
                    shortDescription = urun.ShortDescription,
                    longDescription  = urun.LongDescription,
                    uploadDate       = urun.UploadDate,
                    detail           = urun.ProductSize.Select(k => new
                    {
                        productSize   = k.Size,
                        productColors = k.ProductColor.Select(y => new
                        {
                            id         = y.id,
                            stockCount = y.StockCount,
                            color      = y.ProductColorDetail.Select(u => new
                            {
                                colorName = u.Color.ColorName,
                                colorCode = u.Color.ColorCode,
                            }),
                            productImageGallery = y.ProdutImageGallery.Select(u => new
                            {
                                id        = u.id,
                                imagePath = u.ImagePath
                            })
                        }),
                    }),
                    urunSosyalGucu = new
                    {
                        facebookShareCount   = facebookShareCount,
                        instagramShareCount  = instagramShareCount,
                        twitterShareCount    = twitterShareCount,
                        votedressShareCount  = votedressShareCount,
                        urunluOylamalarCount = urunluOylamalarCount,

                        commentCount = commentCount
                    },
                    comments = urun.ProductComment.OrderBy(x => x.CommentDate).Select(x => new
                    {
                        commentId               = x.id,
                        commentOwnerId          = x.VotedressUser.id,
                        commentOwnerFullName    = x.VotedressUser.UserDetail.Name + " " + x.VotedressUser.UserDetail.SurName,
                        commentOwnerProfilImage = x.VotedressUser.ProfileImage,
                        comment      = x.Comment,
                        commentDate  = x.CommentDate,
                        commentLikes = x.ProductCommentLike.Select(t => new
                        {
                            LikedFullName = t.VotedressUser.UserDetail.Name + " " + t.VotedressUser.UserDetail.SurName,
                            LikedId       = t.VotedressUser.id,
                        }),

                        commentReplies = x.ProductCommentReply.OrderBy(k => k.CommentDate).Select(k => new
                        {
                            commentId               = k.id,
                            commentOwnerId          = k.VotedressUser.id,
                            commentOwnerFullName    = k.VotedressUser.UserDetail.Name + " " + k.VotedressUser.UserDetail.SurName,
                            commentOwnerProfilImage = k.VotedressUser.ProfileImage,
                            comment      = k.Comment,
                            commentDate  = k.CommentDate,
                            commentLikes = k.ProductCommentReplyLike.Select(t => new
                            {
                                LikedFullName = t.VotedressUser.UserDetail.Name + " " + t.VotedressUser.UserDetail.SurName,
                                LikedId       = t.VotedressUser.id,
                            }),
                        })
                    })
                }
            };


            return(View(JsonModel));
        }
        public JsonResult UrunDetayiGetir(Guid UrunID)
        {
            ProductManager productManager = new ProductManager();
            Product        urun           = productManager.UrunGetir(UrunID);

            int commentCount = urun.ProductComment.Count;

            for (int i = 0; i < urun.ProductComment.Count; i++)
            {
                commentCount = commentCount + urun.ProductComment[i].ProductCommentReply.Count();
            }


            SocialShareManager socialShareManager = new SocialShareManager();
            List <SocialShare> urunPaylasimi      = socialShareManager.UrunPaylasimlariniGetir(UrunID);

            OylamaManager oylamaMnager         = new OylamaManager();
            int           urunluOylamalarCount = oylamaMnager.UrunluOylamalariGetir(UrunID).Count();


            int facebookShareCount  = urunPaylasimi.Where(x => x.SocialName == "facebook").Count();
            int instagramShareCount = urunPaylasimi.Where(x => x.SocialName == "instagram").Count();
            int twitterShareCount   = urunPaylasimi.Where(x => x.SocialName == "twitter").Count();
            int votedressShareCount = urunPaylasimi.Where(x => x.SocialName == "votedress").Count();


            var JsonModel = new
            {
                urun = new
                {
                    id           = urun.id,
                    productName  = urun.ProductName,
                    productImage = urun.ProductImage,
                    Collections  = urun.ProductCollection.Select(k => new
                    {
                        id             = k.Collection.id,
                        collectionName = k.Collection.CollectionName,
                        description    = k.Collection.Description,
                        createDate     = k.Collection.CreateDate,
                    }),
                    price            = urun.Price,
                    shortDescription = urun.ShortDescription,
                    longDescription  = urun.LongDescription,
                    uploadDate       = urun.UploadDate,
                    detail           = urun.ProductSize.Select(k => new
                    {
                        productSize   = k.Size,
                        productColors = k.ProductColor.Select(y => new
                        {
                            id         = y.id,
                            stockCount = y.StockCount,
                            color      = y.ProductColorDetail.Select(u => new
                            {
                                colorName = u.Color.ColorName,
                                colorCode = u.Color.ColorCode,
                            }),
                            productImageGallery = y.ProdutImageGallery.Select(u => new
                            {
                                id        = u.id,
                                imagePath = u.ImagePath
                            })
                        }),
                    }),
                    urunSosyalGucu = new
                    {
                        facebookShareCount   = facebookShareCount,
                        instagramShareCount  = instagramShareCount,
                        twitterShareCount    = twitterShareCount,
                        votedressShareCount  = votedressShareCount,
                        urunluOylamalarCount = urunluOylamalarCount,

                        commentCount = commentCount
                    }
                }
            };

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