コード例 #1
0
        public ActionResult Create(ECustomerCategory ECustomerCategory)
        {
            if (ModelState.IsValid)
            {
                ECustomerCategory.ID = ECustomerCategory.ID;
                db.CustomerCategory.Add(ECustomerCategory);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            ViewBag.CustomerCategory = new SelectList(db.CustomerCategory, "ID", "Desc",
                (db.CustomerCategory.FirstOrDefault() == null ? null : db.CustomerCategory.FirstOrDefault().ID.ToString()));

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