public async Task <ActionResult> DeleteConfirmed(int id) { B鳥 b鳥 = await db.B鳥.FindAsync(id); db.B鳥.Remove(b鳥); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "UserId,VerificationId,BirdName,BirdGender,Bird學名Id,RegisteredTime,StatusId")] B鳥 b鳥) { if (ModelState.IsValid) { db.Entry(b鳥).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.StatusId = new SelectList(db.B狀態, "StatusId", "Type", b鳥.StatusId); ViewBag.UserId = new SelectList(db.B鳥奴, "UserId", "Email", b鳥.UserId); ViewBag.Bird學名Id = new SelectList(db.B學名, "Bird學名Id", "Bird學名", b鳥.Bird學名Id); return(View(b鳥)); }
// GET: Bird/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } B鳥 b鳥 = await db.B鳥.FindAsync(id); if (b鳥 == null) { return(HttpNotFound()); } return(View(b鳥)); }
// GET: Bird/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } B鳥 b鳥 = await db.B鳥.FindAsync(id); if (b鳥 == null) { return(HttpNotFound()); } ViewBag.StatusId = new SelectList(db.B狀態, "StatusId", "Type", b鳥.StatusId); ViewBag.UserId = new SelectList(db.B鳥奴, "UserId", "Email", b鳥.UserId); ViewBag.Bird學名Id = new SelectList(db.B學名, "Bird學名Id", "Bird學名", b鳥.Bird學名Id); return(View(b鳥)); }