Exemple #1
0
 public ActionResult Update(Card model, bool isUpdate = false)
 {
     return InsertOrUpdate(model, isUpdate);
 }
Exemple #2
0
 public ActionResult Delete(Card model)
 {
     string errorText;
     TempData["Error"] = context.Delete(model, out errorText) ? null : errorText;
     return RedirectToAction("Index");
 }
Exemple #3
0
 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);
 }
Exemple #4
0
        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);
        }