/// <summary>
 /// Create a new Zloupotrebe object.
 /// </summary>
 /// <param name="zloupotrebaID">Initial value of the ZloupotrebaID property.</param>
 /// <param name="komentarID">Initial value of the KomentarID property.</param>
 /// <param name="korisnikID">Initial value of the KorisnikID property.</param>
 public static Zloupotrebe CreateZloupotrebe(global::System.Int32 zloupotrebaID, global::System.Int32 komentarID, global::System.Int32 korisnikID)
 {
     Zloupotrebe zloupotrebe = new Zloupotrebe();
     zloupotrebe.ZloupotrebaID = zloupotrebaID;
     zloupotrebe.KomentarID = komentarID;
     zloupotrebe.KorisnikID = korisnikID;
     return zloupotrebe;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Zloupotrebe EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToZloupotrebe(Zloupotrebe zloupotrebe)
 {
     base.AddObject("Zloupotrebe", zloupotrebe);
 }
        public ActionResult zloupotreba(int zlID)
        {
            try
            {
                string poruka = "";
                bool uspjeh = false;
                if (Session["Korisnik"] != null)
                {
                    using (Spajanje s = new Spajanje())
                    {
                        Zloupotrebe zl = (from z in s.Context.Zloupotrebe where z.KomentarID == zlID select z).FirstOrDefault();

                        if (zl == null)
                        {

                            zl = new Zloupotrebe();
                            zl.KomentarID = zlID;
                            Korisnici kor = Session["Korisnik"] as Korisnici;
                            zl.KorisnikID = kor.KorisnikID;
                            s.Context.Zloupotrebe.AddObject(zl);
                            s.Context.SaveChanges();

                            uspjeh = true;
                            poruka = "Uspješno prijavljen komentar";
                            //spremi u bazu i vrati stanje
                        }
                        else
                        {
                            poruka = "Prijavili ste ovaj komentar";
                            //error vec ste glasali
                        }
                    }
                }
                else
                {
                    //error morate se logovati
                    poruka = "Morate se prijaviti";
                }

                return Json(new
                {
                    success = uspjeh,
                    message = poruka

                });
            }
            catch (Exception)
            {

                return null;
            }
        }