示例#1
0
        public ActionResult Create(Tool tool)
        {
            if (ModelState.IsValid)
            {
                ProviderContext.Tools.Add(tool);
                ProviderContext.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(tool);
        }
示例#2
0
 public ActionResult Create()
 {
     var model = new Tool();
     return View(model);
 }
示例#3
0
 public ActionResult Edit(Tool tool)
 {
     if (ModelState.IsValid)
     {
         ProviderContext.Entry(tool).State = EntityState.Modified;
         ProviderContext.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(tool);
 }