コード例 #1
0
ファイル: strojeviController.cs プロジェクト: mariorajic/SPG
 public ActionResult Edit([Bind(Include = "id,naziv,datum_kupovine,trosak,vrijednost,id_parcele")] strojevi strojevi)
 {
     if (ModelState.IsValid)
     {
         db.Entry(strojevi).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_parcele = new SelectList(db.parcele, "id", "naziv", strojevi.id_parcele);
     return(View(strojevi));
 }
コード例 #2
0
ファイル: strojeviController.cs プロジェクト: mariorajic/SPG
        public ActionResult DeleteConfirmed(int id)
        {
            strojevi strojevi = db.strojevi.Find(id);

            try
            {
                db.strojevi.Remove(strojevi);
                db.SaveChanges();
            }
            catch
            {
                return(View("Error"));
            }
            return(RedirectToAction("Index"));
        }
コード例 #3
0
ファイル: strojeviController.cs プロジェクト: mariorajic/SPG
        // GET: strojevi/Delete/5
        public ActionResult Delete(int?id)
        {
            int userId = DobaviID();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            strojevi strojevi = db.strojevi.Find(id);

            if (strojevi == null || strojevi.parcele.id_korisnika != userId)
            {
                return(HttpNotFound());
            }
            return(View(strojevi));
        }
コード例 #4
0
ファイル: strojeviController.cs プロジェクト: mariorajic/SPG
        // GET: strojevi/Edit/5
        public ActionResult Edit(int?id)
        {
            int userId = DobaviID();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            strojevi strojevi = db.strojevi.Find(id);

            if (strojevi == null || strojevi.parcele.id_korisnika != userId)
            {
                return(HttpNotFound());
            }
            ViewBag.id_parcele = new SelectList(db.parcele.Where(p => p.id_korisnika == userId), "id", "naziv", strojevi.id_parcele);
            return(View(strojevi));
        }
コード例 #5
0
ファイル: strojeviController.cs プロジェクト: mariorajic/SPG
        // GET: strojevi/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            strojevi strojevi = db.strojevi.Find(id);
            var      userId   = DobaviID();
            string   x        = Url.RequestContext.RouteData.Values["id"].ToString();
            int      Ajdi     = Int32.Parse(x);

            if (strojevi == null || strojevi.parcele.id_korisnika != userId)
            {
                return(HttpNotFound());
            }
            ViewData["Radnje"] = db.radnje_stroja.Where(f => f.id_stroja == Ajdi).ToList();
            return(View(strojevi));
        }