Ejemplo n.º 1
0
 public ActionResult AddIndustry(Industry model)
 {
     if (ModelState.IsValid)
     {
         var industry = new Industry();
         industry.IndustryName = model.IndustryName;
         db.Industries.Add(industry);
         db.SaveChanges();
         return Redirect("/Admin/Foundation/Industry");
     }
     else
     {
         ModelState.AddModelError("", "城市信息填写失败!");
     }
     return View();
 }
Ejemplo n.º 2
0
 public ActionResult IndustryEdit(int id)
 {
     var industry = new Industry();
     industry = db.Industries.Find(id);
     ViewBag.Industry = industry;
     return View();
 }
Ejemplo n.º 3
0
 public ActionResult IndustryEdit(Industry model)
 {
     var industry = db.Industries.Find(model.ID);
     ViewBag.Industry = industry;
     if (ModelState.IsValid)
     {
         industry.IndustryName = model.IndustryName;
         db.SaveChanges();
         return Redirect("/Admin/Foundation/Industry");
     }
     else
     {
         ModelState.AddModelError("", "城市信息填写失败!");
     }
     return View();
 }
Ejemplo n.º 4
0
 public ActionResult IndustryDelete(int id)
 {
     var industry = new Industry();
     industry = db.Industries.Find(id);
     db.Industries.Remove(industry);
     db.SaveChanges();
     return Content("ok");
 }