public ActionResult CreateDefinition(DefinitionModel model) { Definition target = new Definition(); target.displayName = model.displayName; target.keyName = model.keyName; target.keyValue = model.keyValue; target.keyGroup = model.keyGroup; target.sequence = model.sequence; db.Definitions.Add(target); db.SaveChanges(); return RedirectToAction("Index", "System"); }
public ActionResult Create(DefinitionModel model) { if (ModelState.IsValid) { Definition target = new Definition(); target.displayName = model.displayName; target.keyName = model.keyName; target.keyValue = model.keyValue; target.keyGroup = model.keyGroup; if (model.sequence == null || model.sequence < 1) { model.sequence = 1; } target.sequence = model.sequence; db.Definitions.Add(target); db.SaveChanges(); return RedirectToAction("Index"); } return View(model); }
public ActionResult Edit(Definition definition) { if (ModelState.IsValid) { db.Entry(definition).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(definition); }