예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            osoblje osoblje = db.osobljes.Find(id);

            db.osobljes.Remove(osoblje);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "id,ime,prezime,datum_rodjenja,zauzet")] osoblje osoblje)
 {
     if (ModelState.IsValid)
     {
         db.Entry(osoblje).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(osoblje));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "id,ime,prezime,datum_rodjenja,zauzet")] osoblje osoblje)
        {
            if (ModelState.IsValid)
            {
                db.osobljes.Add(osoblje);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(osoblje));
        }
예제 #4
0
        // GET: Osoblje/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            osoblje osoblje = db.osobljes.Find(id);

            if (osoblje == null)
            {
                return(HttpNotFound());
            }
            return(View(osoblje));
        }
예제 #5
0
        public void occupy(int usluga_id)
        {
            IList <normativ_oprema>  normativOpremas  = db.normativ_oprema.Where(no => no.usluga_id == usluga_id).ToList();
            IList <normativ_osoblje> normativOsobljes = db.normativ_osoblje.Where(no => no.usluga_id == usluga_id).ToList();

            foreach (normativ_oprema normativOprema in normativOpremas)
            {
                IList <oprema> opremas = db.opremas.Where(o => o.tip == normativOprema.oprema.tip).Where(o => o.dostupna == "D").ToList();
                oprema         oprema  = opremas.First();
                oprema.dostupna = "N";

                db.Entry(oprema).State = EntityState.Modified;
                db.SaveChanges();
            }

            foreach (normativ_osoblje normativOsoblje in normativOsobljes)
            {
                osoblje osoblje = normativOsoblje.osoblje;
                osoblje.zauzet = "D";

                db.Entry(osoblje).State = EntityState.Modified;
                db.SaveChanges();
            }
        }