コード例 #1
0
        public ActionResult Create(InformationCollection.Models.SourceRegexView sourceregex)
        {
            if (ModelState.IsValid)
            {
                var sourceRegexGroup = db.SourceRegexGroups.Where(p => p.Name == sourceregex.SourceRegexGroup).FirstOrDefault();
                if (sourceRegexGroup == null)
                {
                    sourceRegexGroup = new SourceRegexGroup()
                    {
                        Name = sourceregex.SourceRegexGroup
                    };
                    db.SourceRegexGroups.Add(sourceRegexGroup);
                    db.SaveChanges();
                }

                sourceRegexGroup.SourceRegexes.Add(new SourceRegex
                {
                    IsMatched = sourceregex.IsMatched,
                    RegexType = sourceregex.RegexType,
                    Name = sourceregex.Name,
                    Regex = sourceregex.Regex
                });
                db.SaveChanges();
                return RedirectToAction("Index", new { id = sourceRegexGroup.SourceRegexGroupId });
            }

            return View(sourceregex);
        }
コード例 #2
0
        public ActionResult Create(SourceRegexGroup sourceregexgroup)
        {
            if (ModelState.IsValid)
            {
                db.SourceRegexGroups.Add(sourceregexgroup);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(sourceregexgroup);
        }
コード例 #3
0
 public ActionResult Edit(SourceRegexGroup sourceregexgroup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sourceregexgroup).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(sourceregexgroup);
 }