Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            stanar stanar = db.stanars.Find(id);

            db.stanars.Remove(stanar);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "idstanar,Ime,Prezime,OIB,email,telefon,mobitel,zgrada,password_stanara")] stanar stanar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stanar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stanar));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "idstanar,Ime,Prezime,OIB,email,telefon,mobitel,zgrada,password_stanara")] stanar stanar)
        {
            if (ModelState.IsValid)
            {
                int noviId = (from st in db.stanars select st).Max(x => x.idstanar) + 1;
                stanar.idstanar = noviId;
                db.stanars.Add(stanar);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(stanar));
        }
Пример #4
0
        // GET: stanars/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            stanar stanar = db.stanars.Find(id);

            if (stanar == null)
            {
                return(HttpNotFound());
            }
            return(View(stanar));
        }
Пример #5
0
        public ActionResult Prijava(stanar objUser)
        {
            var obj = db.stanars.SingleOrDefault(a => a.email.Equals(objUser.email) && a.password_stanara.Equals(objUser.password_stanara));

            if (obj != null)
            {
                Session["idstanar"] = obj.idstanar;
                Session["email"]    = obj.email;
                Session["zgrada"]   = obj.zgrada;
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Message = " Unesli ste krivu lozinku, pokušajte ponovo";
            }

            return(View(objUser));
        }