public ActionResult Edit([Bind(Include = "id,nazwa,adres,stan_wypelnienia")] magazyny magazyny) { if (ModelState.IsValid) { db.Entry(magazyny).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(magazyny)); }
public ActionResult Create([Bind(Include = "id,nazwa,adres,stan_wypelnienia")] magazyny magazyny) { if (ModelState.IsValid) { db.magazyny.Add(magazyny); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(magazyny)); }
// GET: Warehouses/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } magazyny magazyny = db.magazyny.Find(id); if (magazyny == null) { return(HttpNotFound()); } return(View(magazyny)); }
public ActionResult DeleteConfirmed(int id) { magazyny magazyny = db.magazyny.Find(id); try { db.magazyny.Remove(magazyny); db.SaveChanges(); } catch (DataException error) { TempData["error"] = true; return(RedirectToAction("Delete")); } return(RedirectToAction("Index")); }