// // GET: /Groups/Details/5 public PartialViewResult Details(int GroupID) { if (!AccessActions.IsAccess("Groups::Read")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } GroupModel Group = new GroupModel(); Group = Group.FindOne(Convert.ToInt32(GroupID)); ViewBag.ID = GroupID; ViewBag.NameGr = Group.Name; return(PartialView("_Abonents", Group.Abonents())); }
// // GET: /Groups/Edit/5 public PartialViewResult EditIndex(int GroupID) { if (!AccessActions.IsAccess("Groups::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); ViewBag.Error = "Нет доступа!"; return(PartialView("_Error")); } GroupModel Group = new GroupModel(); Group = Group.FindOne(GroupID); ViewBag.GroupAbonents = Group.Abonents(); ViewBag.AllAbonents = Group.AbonentsAll(); BrancheModel branch = new BrancheModel(); ViewBag.AllBranches = branch.FindAll(); return(PartialView("_AbonentsGroupEdit", Group)); }
// // GET: /Groups/Delete/5 public ActionResult Delete(int id) { if (!AccessActions.IsAccess("Groups::Write")) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", "Нет доступа!"); return(RedirectToAction("Error", "User", route)); } try { // TODO: Add delete logic here GroupModel theGroup = new GroupModel(); theGroup.FindOne(id); theGroup.Delete(); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; return(View("Index")); } }