public ActionResult DeleteConfirmed(int id) { OperaModel opera = db.Opery.Find(id); db.Opery.Remove(opera); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "OperaID,Nazwa,Rok,Kompozytor,Dlugosc")] OperaModel opera) { if (ModelState.IsValid) { db.Entry(opera).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
public ActionResult Create([Bind(Include = "OperaID,Nazwa,Rok,Kompozytor,Dlugosc")] OperaModel opera) { if (ModelState.IsValid) { db.Opery.Add(opera); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opera)); }
public IActionResult Index() { OperaModel o = new OperaModel() { OperaID = 1, Title = "你好我樂樂", Year = 1600, Composer = "佩里" }; return(View(o)); }
// GET: Opery/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OperaModel opera = db.Opery.Find(id); if (opera == null) { return(HttpNotFound()); } return(View(opera)); }