コード例 #1
0
        // GET: Admin/Main_Type/Edit/5
        public ActionResult Edit(int?id)
        {
            Main_Type type = db.Main_Type.Find(id);

            ViewBag.typeID = type;
            ViewBag.type   = db.Main_Type;
            return(PartialView("_TypeEdit"));
        }
コード例 #2
0
        public ActionResult Create(FormCollection form)
        {
            int       id   = Convert.ToInt32(form["id"]);
            string    name = form["Name"].ToString();
            Main_Type type = new Main_Type()
            {
                Name = name
            };

            db.Main_Type.Add(type);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }