public async Task <ActionResult> DeleteConfirmed(int id) { RareResource rareResource = await db.RareResources.FindAsync(id); db.RareResources.Remove(rareResource); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "PrimaryKey,Name,ImgUrl")] RareResource rareResource) { if (ModelState.IsValid) { db.Entry(rareResource).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(rareResource)); }
public async Task <ActionResult> Create([Bind(Include = "PrimaryKey,Name,ImgUrl")] RareResource rareResource) { if (ModelState.IsValid) { db.RareResources.Add(rareResource); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(rareResource)); }
// GET: RareResources/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RareResource rareResource = await db.RareResources.FindAsync(id); if (rareResource == null) { return(HttpNotFound()); } return(View(rareResource)); }