コード例 #1
0
        public ActionResult Updata(int ID)
        {
            PermissionEntities perEntities = new PermissionEntities();
            var list = perEntities.RoleTable.Where(x => x.ID == ID).First();

            return(View(list));
        }
コード例 #2
0
        public ActionResult List(int p = 1)
        {
            PermissionEntities perEntities = new PermissionEntities();
            int    pagesize  = 10;
            int    count     = GetCount();
            string pagerInfo = Pager3.CreatePageNums(count, pagesize, p);

            ViewBag.pager = pagerInfo;

            //第二页数据
            // var pagerList = perEntities.RolePermission.OrderBy(x => x.ID).Skip((p - 1) * pagesize).Take(10).ToList();

            var query = perEntities.RolePermission.Join(perEntities.RoleTable,
                                                        rp => rp.RoleID,
                                                        r => r.ID,
                                                        (rp, r) => new {
                rp.ID,
                RoleName = r.Name,
                rp.PermissionID
            });

            var list = query.Join(perEntities.Permission, rp => rp.PermissionID, g => g.ID, (rp, g) => new ViewModels.RolePermissionView()
            {
                ID             = rp.ID,
                RoleName       = rp.RoleName,
                PermissionName = g.Name
            }).OrderBy(x => x.ID).Skip((p - 1) * pagesize).Take(10).ToList();

            return(View(list));
        }
コード例 #3
0
        public ActionResult List(int p = 1)
        {
            PermissionEntities perEntities = new PermissionEntities();
            int    pagesize  = 10;
            int    count     = GetCount();
            string pagerInfo = Pager.CreatePageNums(count, pagesize, p);

            ViewBag.pager = pagerInfo;
            //第二页数据
            //var pagerList = perEntities.User.OrderBy(x => x.ID).Skip((p - 1) * pagesize).Take(10).ToList();
            var query = perEntities.User.Join(perEntities.RoleTable,
                                              rp => rp.RoleID,
                                              r => r.ID,
                                              (rp, r) => new ViewModels.RoleUser {
                ID             = rp.ID,
                RoleName       = r.Name,
                UserName       = rp.Name,
                UserPwd        = rp.Pwd,
                UserSex        = rp.Sex,
                UserDepartment = rp.Department,
                UserPhone      = rp.Phone
            }).OrderBy(x => x.ID).Skip((p - 1) * pagesize).Take(10).ToList();


            return(View(query));
        }
コード例 #4
0
        public ActionResult Succeed(RolePermission pope)
        {
            PermissionEntities perEntities = new PermissionEntities();

            perEntities.RolePermission.Add(pope);
            perEntities.SaveChanges();
            return(Redirect("/RolePermission_Zhang_/List"));
        }
コード例 #5
0
        public ActionResult Succeed(User user)
        {
            PermissionEntities perEntities = new PermissionEntities();

            perEntities.User.Add(user);
            perEntities.SaveChanges();
            return(Redirect("/User_Zhang_/List"));
        }
コード例 #6
0
        public ActionResult Succeed(RoleTable po)
        {
            PermissionEntities perEntities = new PermissionEntities();

            perEntities.RoleTable.Add(po);
            perEntities.SaveChanges();
            return(Redirect("/Role_Zhang_/List"));
            //return View();
        }
コード例 #7
0
        public ActionResult Succeed(Permission per)
        {
            PermissionEntities perEntities = new PermissionEntities();

            perEntities.Permission.Add(per);
            perEntities.SaveChanges();
            return(Redirect("/Permission_Zhang_/List"));
            //return View();
        }
コード例 #8
0
        public ActionResult Delete(RolePermission pope)
        {
            PermissionEntities perEntities = new PermissionEntities();

            System.Data.Entity.Infrastructure.DbEntityEntry entityEntry = perEntities.Entry(pope);
            entityEntry.State = System.Data.Entity.EntityState.Deleted;
            perEntities.SaveChanges();

            return(Redirect("/RolePermission_Zhang_/List"));
        }
コード例 #9
0
        public ActionResult Updata(int ID)
        {
            PermissionEntities perEntities = new PermissionEntities();
            var list = perEntities.User.Where(x => x.ID == ID).First();
            List <RoleTable> rolelist = perEntities.RoleTable.ToList();

            ViewBag.poList = rolelist;
            sId            = ID;
            return(View(list));
        }
コード例 #10
0
        public ActionResult List(int p = 1)
        {
            PermissionEntities perEntities = new PermissionEntities();
            int    pagesize  = 10;
            int    count     = GetCount();
            string pagerInfo = Pager2.CreatePageNums(count, pagesize, p);

            ViewBag.pager = pagerInfo;
            //第二页数据
            var pagerList = perEntities.RoleTable.OrderBy(x => x.ID).Skip((p - 1) * pagesize).Take(10).ToList();

            return(View(pagerList));
        }
コード例 #11
0
        public ActionResult Updata(RoleTable po)
        {
            if (po.Name != "")
            {
                //声明数据库上下文类
                PermissionEntities perEntities = new PermissionEntities();
                System.Data.Entity.Infrastructure.DbEntityEntry entityEntry = perEntities.Entry(po);
                entityEntry.State = System.Data.Entity.EntityState.Modified;
                perEntities.SaveChanges();
            }
            else
            {
                return(Content("名称为空"));
            }


            return(Redirect("/Role_Zhang_/List"));
        }
コード例 #12
0
        public ActionResult Updata(RolePermission pope)
        {
            if (pope.RoleID != null || pope.PermissionID != null)
            {
                pope.ID = sId;
                //声明数据库上下文类
                PermissionEntities perEntities = new PermissionEntities();
                System.Data.Entity.Infrastructure.DbEntityEntry entityEntry = perEntities.Entry(pope);
                entityEntry.State = System.Data.Entity.EntityState.Modified;
                perEntities.SaveChanges();
            }
            else
            {
                return(Content("名称为空"));
            }


            return(Redirect("/RolePermission_Zhang_/List"));
        }
コード例 #13
0
        public ActionResult Updata(User user)
        {
            if (user.Name != "")
            {
                user.ID = sId;
                //声明数据库上下文类
                PermissionEntities perEntities = new PermissionEntities();
                System.Data.Entity.Infrastructure.DbEntityEntry entityEntry = perEntities.Entry(user);
                entityEntry.State = System.Data.Entity.EntityState.Modified;
                perEntities.SaveChanges();
            }
            else
            {
                return(Content("名称为空"));
            }


            return(Redirect("/User_Zhang_/List"));
        }