// GET: Meni public ActionResult Index() { PEPBazaEntities1 ctx = new PEPBazaEntities1(); List <Korisnici> k = ctx.Korisnici.ToList(); return(View("Index", k)); }
// GET: Neki public ActionResult Index() { PEPBazaEntities1 ctx = new PEPBazaEntities1(); List <Korisnici> k = ctx.Korisnici.ToList(); return(Json(k, JsonRequestBehavior.AllowGet)); }
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); } }