public ActionResult Create(Action actionType) { var actionToCreate = new Action { Name = actionType.Name }; actionToCreate.TransferValidationMessagesTo(ModelState); if (ModelState.IsValid) { //save _actionRepository.EnsurePersistent(actionToCreate); Message = "Action created successfully"; return RedirectToAction("Index"); } else { return View(); } }
public ActionResult Edit(int id, Action actionType) { var action = _actionRepository.GetNullableById(id); Check.Require(action != null, "Action not found"); action.Name = actionType.Name; //update action.TransferValidationMessagesTo(ModelState); if (ModelState.IsValid) { _actionRepository.EnsurePersistent(action); Message = "Action edited successfully"; return RedirectToAction("Index"); } else { return View(action); } }
// // GET: /Action/Create public ActionResult Create() { var action = new Action(); return View(action); }