//合併 public ActionResult MonsterItem() { treasureService = new TreasureService(); var model = treasureService.QueryName(); return(View(model)); }
// GET: Treasure public ActionResult Index() { treasureService = new TreasureService(); var model = treasureService.GetAll().ToList(); return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { treasureService = new TreasureService(); List <Common.Entities.Treasure> list = treasureService.GetAll().ToList(); GridView1.DataSource = list; GridView1.DataBind(); }
public ActionResult Create(Treasure model) { treasureService = new TreasureService(); var chk = treasureService.Add(model); if (chk) { return(RedirectToAction("Index")); } else { return(HttpNotFound()); } }
public ActionResult Edit(Treasure model) { treasureService = new TreasureService(); var chk = treasureService.Update(model); if (chk) { return(RedirectToAction("Index")); } else { return(View(model)); } }
//Edit功能 public ActionResult Edit(int?id) { if (id == null) { return(HttpNotFound()); } treasureService = new TreasureService(); var chk = treasureService.Query((int)id); if (chk == null) { return(HttpNotFound()); } else { return(View(chk)); } }
//Delete功能 public ActionResult Delete(int?id) { if (id == null) { return(HttpNotFound()); } treasureService = new TreasureService(); var chk = treasureService.Delete((int)id); if (chk) { return(RedirectToAction("Index")); } else { return(HttpNotFound()); } }