public ActionResult Update(Card model, bool isUpdate = false) { return InsertOrUpdate(model, isUpdate); }
public ActionResult Delete(Card model) { string errorText; TempData["Error"] = context.Delete(model, out errorText) ? null : errorText; return RedirectToAction("Index"); }
public ActionResult Insert(Card model, bool isUpdate = false) { model.Id = model.Name.ToLower().Replace(" ", "_").Replace("[^a-z0-9]*", ""); //Guid.NewGuid().ToString(); return InsertOrUpdate(model, isUpdate); }
private ActionResult InsertOrUpdate(Card model, bool isUpdate = false) { if (ModelState.IsValid) { string errorText; TempData["Error"] = context.InsertOrUpdate(model, out errorText) ? null : errorText; return RedirectToAction("Index"); } // Process model errors. ViewBag.IsUpdate = isUpdate; return View("CreateOrEdit", model); }