public ActionResult Edit(CustomerTabGroup customerTabGroup) { var tempuser = db.Users.FirstOrDefault(s => s.Id == AccontData.UserID); //防止企业用户串号修改 if ((AccontData.UserType == UserType.Enterprise && tempuser.EnterpriseID != AccontData.EnterpriseID) || AccontData.EnterpriseID <= 0) { return(this.ToError("错误", "没有该操作权限", Url.Action("Index"))); } Sidebar(); var temp = db.CustomerTabGroups.FirstOrDefault(s => s.ID == customerTabGroup.ID); if (ModelState.IsValid) { temp.Name = customerTabGroup.Name; temp.Sort = customerTabGroup.Sort; temp.Style = customerTabGroup.Style; temp.EnterpriseID = AccontData.EnterpriseID; //db.Entry(customerTabGroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTabGroup)); }
// GET: CustomerTabGroupsManage/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerTabGroup customerTabGroup = db.CustomerTabGroups.Find(id); if (customerTabGroup == null) { return(HttpNotFound()); } return(View(customerTabGroup)); }
public ActionResult DeleteConfirmed(int id) { var tempuser = db.Users.FirstOrDefault(s => s.Id == AccontData.UserID); //防止企业用户串号修改 if ((AccontData.UserType == UserType.Enterprise && tempuser.EnterpriseID != AccontData.EnterpriseID) || AccontData.EnterpriseID <= 0) { return(this.ToError("错误", "没有该操作权限", Url.Action("Index"))); } Sidebar(); CustomerTabGroup customerTabGroup = db.CustomerTabGroups.Find(id); db.CustomerTabGroups.Remove(customerTabGroup); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(CustomerTabGroup customerTabGroup) { var tempuser = db.Users.FirstOrDefault(s => s.Id == AccontData.UserID); //防止企业用户串号修改 if ((AccontData.UserType == UserType.Enterprise && tempuser.EnterpriseID != AccontData.EnterpriseID) || AccontData.EnterpriseID <= 0) { return(this.ToError("错误", "没有该操作权限", Url.Action("Index"))); } Sidebar(); if (ModelState.IsValid) { customerTabGroup.EnterpriseID = AccontData.EnterpriseID; db.CustomerTabGroups.Add(customerTabGroup); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTabGroup)); }
public ActionResult Edit(int?id) { var tempuser = db.Users.FirstOrDefault(s => s.Id == AccontData.UserID); //防止企业用户串号修改 if ((AccontData.UserType == UserType.Enterprise && tempuser.EnterpriseID != AccontData.EnterpriseID) || AccontData.EnterpriseID <= 0) { return(this.ToError("错误", "没有该操作权限", Url.Action("Index"))); } Sidebar(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerTabGroup customerTabGroup = db.CustomerTabGroups.Find(id); if (customerTabGroup == null) { return(HttpNotFound()); } return(View(customerTabGroup)); }