public ActionResult BuildingEdit(int id, FormCollection collection) { Building s = db.Buildings.Find(id); if (s == null) { s = new Building(); db.Buildings.Add(s); } //collection.Remove(""); TryUpdateModel(s, "", new string[] { }, new string[] { "" }, collection); if (!UserInfo.CurUser.HasRight("租赁管理-项目维护")) return Redirect("~/content/AccessDeny.htm"); if (ModelState.IsValid) { db.SaveChanges(); if (id == 0) { BLL.Utilities.AddLogAndSave(s.Id, Building.LogClass, "创建", ""); } else { BLL.Utilities.AddLogAndSave(s.Id, Building.LogClass, "修改", ""); } return Redirect("../BuildingView/" + s.Id); } return View(s); }
public ActionResult BuildingEdit(int id) { Building s = db.Buildings.Find(id); if (s == null) { s = new Building(); } if (!UserInfo.CurUser.HasRight("租赁管理-项目维护")) return Redirect("~/content/AccessDeny.htm"); return View(s); }