public ActionResult Edit(int id, FormCollection collection) { SaleStore s = db.SaleStores.Find(id); if(s==null) { s = new SaleStore(); db.SaleStores.Add(s); } //collection.Remove(""); TryUpdateModel(s, "", new string[]{}, new string[] { },collection); if (ModelState.IsValid) { db.SaveChanges(); if(id==0) { BLL.Utilities.AddLog(s.Id, SaleStore.LogClass, "创建", ""); } else { BLL.Utilities.AddLog(s.Id, SaleStore.LogClass, "修改", ""); } return Redirect("../View/" + s.Id); } return View(s); }
public ActionResult Edit(int id) { SaleStore s = db.SaleStores.Find(id); if(s==null) { s=new SaleStore(); } return View(s); }