public async Task <ActionResult> DeleteConfirmed(int id) { LocalHistory localHistory = await db.LocalHistories.FindAsync(id); db.LocalHistories.Remove(localHistory); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Title,ImageUrl,Content,KeyWord,DatePublished")] LocalHistory localHistory) { if (ModelState.IsValid) { db.Entry(localHistory).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(localHistory)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Title,ImageUrl,Content,KeyWord,DatePublished")] LocalHistory localHistory) { if (ModelState.IsValid) { db.LocalHistories.Add(localHistory); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(localHistory)); }
// GET: LocalHistory/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LocalHistory localHistory = await db.LocalHistories.FindAsync(id); if (localHistory == null) { return(HttpNotFound()); } return(View(localHistory)); }