コード例 #1
0
 public IActionResult Create(ApplicationType app)
 {
     if (ModelState.IsValid)
     {
         _db.Add(app);
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(app));
 }
コード例 #2
0
        public IActionResult Create(Category cat)
        {
            _db.Add(cat);
            _db.SaveChanges();
            return(RedirectToAction("Index"));

            //Using ServerSide Validation
            //if (ModelState.IsValid)
            //{
            //    _db.Add(cat);
            //    _db.SaveChanges();
            //    return RedirectToAction("Index");
            //}
            //return View(cat);
        }