public ActionResult Edit(int id, FormCollection collection) { Company s = db.Companies.Find(id); if (s == null) { s = new Company(); db.Companies.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, Company.LogClass, "创建", ""); } else { BLL.Utilities.AddLogAndSave(s.Id, Company.LogClass, "修改", ""); } return Redirect("../View/" + s.Id); } return View(s); }
public ActionResult Edit(int id) { Company s = db.Companies.Find(id); if (s == null) { s = new Company(); } if (!UserInfo.CurUser.HasRight("租赁管理-公司账号")) return Redirect("~/content/AccessDeny.htm"); return View(s); }