public async Task <ActionResult> DeleteConfirmed(int id) { try { ExtraAttribute extraAttribute = await db.ExtraAttributes.FindAsync(id); db.ExtraAttributes.Remove(extraAttribute); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } catch { return(PartialView("Error404")); } }
public async Task <ActionResult> Edit([Bind(Include = "AttributeID,Name,AttributeTypeID")] ExtraAttribute extraAttribute) { try { if (ModelState.IsValid) { db.Entry(extraAttribute).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.AttributeTypeID = new SelectList(db.AttributeTypes, "AttributeTypeID", "Name", extraAttribute.AttributeTypeID); return(View(extraAttribute)); } catch { return(PartialView("Error404")); } }
public async Task <ActionResult> Create([Bind(Include = "AttributeID,Name,AttributeTypeID")] ExtraAttribute extraAttribute) { try { if (ModelState.IsValid) { db.ExtraAttributes.Add(extraAttribute); await db.SaveChangesAsync(); return(RedirectToAction("Create", "BookAddAttributes")); } ViewBag.AttributeTypeID = new SelectList(db.AttributeTypes, "AttributeTypeID", "Name", extraAttribute.AttributeTypeID); return(RedirectToAction("Create", "BookAddAttributes")); } catch { return(PartialView("Error404")); } }
// GET: Attributes/Delete/5 public async Task <ActionResult> Delete(int?id) { try { if (id == null) { return(PartialView("Error404")); } ExtraAttribute extraAttribute = await db.ExtraAttributes.FindAsync(id); if (extraAttribute == null) { return(PartialView("Error404")); } return(View(extraAttribute)); } catch { return(PartialView("Error404")); } }
// GET: Attributes/Edit/5 public async Task <ActionResult> Edit(int?id) { try { if (id == null) { return(PartialView("Error404")); } ExtraAttribute extraAttribute = await db.ExtraAttributes.FindAsync(id); if (extraAttribute == null) { return(PartialView("Error404")); } ViewBag.AttributeTypeID = new SelectList(db.AttributeTypes, "AttributeTypeID", "Name", extraAttribute.AttributeTypeID); return(View(extraAttribute)); } catch { return(PartialView("Error404")); } }