public ActionResult Delete(int id, Product product) { try { // TODO: Add delete logic here return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Product product) { try { ViewBag.ProductTypes = _db.ProductTypes.OrderBy(x => x.Name); if (ModelState.IsValid) { _db.Products.Add(Mapper.Map<SimGame.Domain.Product>(product)); _db.Commit(); } return View(product); } catch { return View(); } }
public ActionResult Edit(int id, Product product) { try { var dbProduct = _db.Products.FirstOrDefault(x => x.Id == id); if (dbProduct == null) return HttpNotFound(); Mapper.Map(product, dbProduct); return Redirect(TempData["ReturnURL"].ToString()); } catch { return View(); } }