コード例 #1
0
ファイル: SystemController.cs プロジェクト: nhuang/sms
        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");
        }
コード例 #2
0
ファイル: SystemController.cs プロジェクト: nhuang/sms
 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());
 }
コード例 #3
0
ファイル: SystemController.cs プロジェクト: nhuang/sms
        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);
        }