public ActionResult DeleteConfirmed(int id) { ProductLinkText productLinkText = db.ProductLinkTexts.Find(id); db.ProductLinkTexts.Remove(productLinkText); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(int id) { ProductLinkText productLinkText = await db.ProductLinkTexts.FindAsync(id); db.ProductLinkTexts.Remove(productLinkText); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Title")] ProductLinkText productLinkText) { if (ModelState.IsValid) { db.Entry(productLinkText).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productLinkText)); }
public async Task <ActionResult> Edit(ProductLinkText productLinkText) { if (ModelState.IsValid) { db.Entry(productLinkText).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(productLinkText)); }
public ActionResult Delete(int id) { ProductLinkText productLinkText = _unitOfWork.Repository <ProductLinkText>().Get(id); if (productLinkText == null) { return(HttpNotFound()); } return(View(productLinkText)); }
public ActionResult Create([Bind(Include = "Id,Title")] ProductLinkText productLinkText) { if (ModelState.IsValid) { db.ProductLinkTexts.Add(productLinkText); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productLinkText)); }
public async Task <ActionResult> Create(ProductLinkText productLinkText) { if (ModelState.IsValid) { db.ProductLinkTexts.Add(productLinkText); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(productLinkText)); }
public ActionResult Create( [Bind(Include = "Id,Title")] ProductLinkText productLinkText) { if (ModelState.IsValid) { _unitOfWork.Repository <ProductLinkText>().Add(productLinkText); _unitOfWork.Save(); return(RedirectToAction("Index")); } return(View(productLinkText)); }
public ActionResult ConfirmDelete(int id) { ProductLinkText productLinkText = _unitOfWork.Repository <ProductLinkText>().Get(id); if (productLinkText != null) { _unitOfWork.Repository <ProductLinkText>().Remove(productLinkText); _unitOfWork.Save(); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Include = "Id,Title")] ProductLinkText productLinkText) { if (ModelState.IsValid) { db.ProductLinktext.Add(productLinkText); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(productLinkText)); }
// GET: Admin/ProductLinkText/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductLinkText productLinkText = await db.ProductLinkTexts.FindAsync(id); if (productLinkText == null) { return(HttpNotFound()); } return(View(productLinkText)); }
public ActionResult Edit( [Bind(Include = "Id,Title")] ProductLinkText productLinkText) { if (ModelState.IsValid) { ProductLinkText p = _unitOfWork.Repository <ProductLinkText>().Get(productLinkText.Id); p.Title = productLinkText.Title; _unitOfWork.Save(); return(RedirectToAction("Index")); } return(View(productLinkText)); }
public async Task <ActionResult> DeleteConfirmed(int id) { ProductLinkText productLinkText = await db.ProductLinkTexts.FindAsync(id); // check to see if ProductLinkText is in use before deleting, if so, don't delete var isUnused = await db.Products.CountAsync(i => i.ProductLinkTextId.Equals(id)) == 0; if (isUnused) { db.ProductLinkTexts.Remove(productLinkText); await db.SaveChangesAsync(); } return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(int id) { ProductLinkText productLinkText = await db.ProductLinkTexts.FindAsync(id); var isUnused = await db.Products.CountAsync(i => i.ProductLinkTextId.Equals(id)) == 0; if (isUnused) { db.ProductLinkTexts.Remove(productLinkText); await db.SaveChangesAsync(); } return(RedirectToAction("Index")); }
// GET: Admin/ProductLinkText/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductLinkText productLinkText = db.ProductLinkTexts.Find(id); if (productLinkText == null) { return(HttpNotFound()); } return(View(productLinkText)); }