예제 #1
0
        public ActionResult HomePage()
        {
            LogiraniSes ls = Session["Logirani"] as LogiraniSes;

            if (ls.Korisnik)
            {
                return(View("KorisnickiDio"));
            }
            return(View("Index"));
        }
예제 #2
0
        public static List <Header> ArtHeader()
        {
            List <Header> LH = new List <Header>();

            Header NoviH = new Header();

            NoviH.Datum  = DateTime.Now.ToShortDateString();
            NoviH.Naslov = "Lista Artikala";
            LogiraniSes Logirani = (HttpContext.Current.Session["Logirani"] as LogiraniSes);

            NoviH.Autor = Logirani.Ime_Prezime;

            LH.Add(NoviH);
            return(LH);
        }
예제 #3
0
        public ActionResult chkLogin(string UserName, string password)
        {
            Osoba Loged = new Osoba();

            Loged = CTX.Osobe.Where(x => x.UserName == UserName && x.Password == password).FirstOrDefault();


            if (Loged == null)
            {
                return(RedirectToAction("Index", new { UN = UserName, Pass = "", Msg = " Ovaj korisnik ne postoji ili ste unjeli pogresnu lozinku " }));
            }

            LogiraniSes LS = new LogiraniSes();

            Session["Logirani"] = null;

            LS.LogiraniId  = Loged.Id;
            LS.Ime_Prezime = Loged.Ime + " " + Loged.Prezime;
            LS.UserName    = Loged.UserName;

            if (CTX.Zaposlenici.Find(Loged.Id) != null)
            {
                LS.Korisnik             = false;
                LS.ZaduzenjeZaposlenika = CTX.Zaposlenici.Find(Loged.Id).Zaduzenje.Naziv;
            }
            else
            {
                LS.Korisnik        = true;
                LS.StatusKorisnika = CTX.Korisnici.Where(x => x.Id == Loged.Id).FirstOrDefault().Status;

                if (LS.StatusKorisnika == false)
                {
                    return(RedirectToAction("Index", new { UN = UserName, Pass = "", Msg = " Vas korisnik jos nije aktivan " }));
                }
            }
            FormsAuthentication.SetAuthCookie(LS.UserName, false);
            Session["Logirani"] = LS;
            return(RedirectToAction("HomePage"));
        }