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 Definition_Update([DataSourceRequest] DataSourceRequest request, DefinitionModel model) { if (model != null && ModelState.IsValid) { { var target = db.Definitions.Find(model.definitionId); target.displayName = model.displayName; target.keyName = model.keyName; target.keyValue = model.keyValue; target.keyGroup = model.keyGroup; target.sequence = model.sequence; db.Entry(target).State = EntityState.Modified; db.SaveChanges(); } } return Json(ModelState.ToDataSourceResult()); }
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); }