Exemple #1
0
        // GET: Meni
        public ActionResult Index()
        {
            PEPBazaEntities1 ctx = new PEPBazaEntities1();
            List <Korisnici> k   = ctx.Korisnici.ToList();

            return(View("Index", k));
        }
Exemple #2
0
        // GET: Neki
        public ActionResult Index()
        {
            PEPBazaEntities1 ctx = new PEPBazaEntities1();
            List <Korisnici> k   = ctx.Korisnici.ToList();

            return(Json(k, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public static Kupci GetLogiraniKorisnik(HttpContextBase context)
        {
            Kupci korisnik = (Kupci)context.Session[LogiraniKorisnik];

            if (korisnik != null)
            {
                return(korisnik);
            }

            HttpCookie cookie = context.Request.Cookies.Get("_mvc_session");

            if (cookie == null)
            {
                return(null);
            }

            long userId;

            try
            {
                userId = long.Parse(cookie.Value);
            }
            catch
            {
                return(null);
            }



            using (PEPBazaEntities1 db = new PEPBazaEntities1())
            {
                Kupci k = db.Kupci



                          .SingleOrDefault(x => x.KupacID == userId);

                PokreniNovuSesiju(k, context, true);
                return(k);
            }
        }