Example #1
0
        public ActionResult Vote()
        {
            int id = Convert.ToInt32(Request.Form["id"]);

            if (!BGKFunction.GetMyRole().OyKullanma)
            {
                return(Content("Oy Kullanma yetkiniz yok :("));
            }
            else if (!BGKFunction.IsPostVoted(id))
            {
                bgk_oylama rating = new bgk_oylama();
                rating.Puan = Convert.ToInt32(Request.Form["point"]);
                if (Session["memberInfo"] != null)
                {
                    rating.UyeID = (int)Session["memberID"];
                }
                else
                {
                    rating.OylayanIP = BGKFunction.GetIPAddress();
                }
                rating.YaziID = id;
                Db.bgk_oylama.Add(rating);
                Db.SaveChanges();
                return(Content("Oy kullandığınız için teşekkür ederiz."));
            }
            else
            {
                return(Content("Daha önce oy kullandınız."));
            }
        }
        public ActionResult Vote()
        {
            int id = Convert.ToInt32(Request.Form["id"]);

            if (!BGKFunction.IsVoted(id))
            {
                string[] optionID = Request.Form["optionID"].Replace("%2c", ",").Split(',');
                for (int i = 0; i < optionID.Length; i++)
                {
                    bgk_anket_secim selection = new bgk_anket_secim();
                    if (Session["memberInfo"] != null)
                    {
                        selection.UyeID = (int)Session["memberID"];
                    }
                    else
                    {
                        selection.OylayanIP = BGKFunction.GetIPAddress();
                    }
                    selection.SecenekID   = Convert.ToInt32(optionID[i]);
                    selection.SecimTarihi = DateTime.Now;
                    Db.bgk_anket_secim.Add(selection);
                }
                Db.SaveChanges();
                return(Content("Oy kullandığınız için teşekkür ederiz.<br />Oylar sayılıyor.."));
            }
            else
            {
                return(Content("Daha önce oy kullandınız.."));
            }
        }