示例#1
0
 public ActionResult Edit([Bind(Include = "id,ime")] zadruge zadruge)
 {
     if (ModelState.IsValid)
     {
         db.Entry(zadruge).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(zadruge));
 }
示例#2
0
        public ActionResult Create([Bind(Include = "id,ime")] zadruge zadruge)
        {
            if (ModelState.IsValid)
            {
                db.zadruge.Add(zadruge);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(zadruge));
        }
示例#3
0
        // GET: zadruge/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            zadruge zadruge = db.zadruge.Find(id);

            if (zadruge == null)
            {
                return(HttpNotFound());
            }
            return(View(zadruge));
        }
示例#4
0
        // GET: zadruge/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            zadruge zadruge = db.zadruge.Find(id);

            if (zadruge == null)
            {
                return(HttpNotFound());
            }
            ViewData["Clanovi"] = db.gospodarstva.Where(g => g.zadruge.id == id).ToList();
            return(View(zadruge));
        }
示例#5
0
        public ActionResult DeleteConfirmed(int id)
        {
            zadruge zadruge = db.zadruge.Find(id);

            try
            {
                db.zadruge.Remove(zadruge);
                db.SaveChanges();
            }
            catch
            {
                return(View("Error"));
            }
            return(RedirectToAction("Index"));
        }