Exemplo n.º 1
0
        public ActionResult GetUserRoleData(string userid)
        {
            var _draw          = Request.Form.GetValues("draw").FirstOrDefault();
            var _start         = Request.Form.GetValues("start").FirstOrDefault();
            var _length        = Request.Form.GetValues("length").FirstOrDefault();
            var _sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault();
            var _sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();
            var _searchValue   = Request.Form.GetValues("search[value]").FirstOrDefault();

            int _pageSize = _length != null?Convert.ToInt32(_length) : 0;

            int _skip = _start != null?Convert.ToInt32(_start) : 0;

            var _model = new UserRoleModel
            {
                UserID = long.Parse(userid)
            };

            var request = new UserRoleRequest
            {
                Draw          = _draw,
                SearchValue   = _searchValue,
                SortColumn    = _sortColumn,
                SortColumnDir = _sortColumnDir,
                PageSize      = _pageSize,
                Skip          = _skip,
                Data          = _model
            };

            var response = new UserRoleHandler(_unitOfWork, _context).GetRoleBasedOnOrganization(request);

            return(Json(new { data = response.Data, recordsFiltered = response.RecordsFiltered, recordsTotal = response.RecordsTotal, draw = response.Draw }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult UserRoleList()
        {
            UserRoleModel rpmodel = new UserRoleModel();

            if (Request.QueryString["userid"] != null)
            {
                var reqOrg = new UserRequest
                {
                    Data = new UserModel
                    {
                        Id = Convert.ToInt64(Request.QueryString["userid"].ToString())
                    }
                };

                var respUser = new UserResponse();
                respUser         = new UserHandler(_unitOfWork).GetDetail(reqOrg);
                rpmodel.UserName = respUser.Entity.UserName;
                rpmodel.UserID   = respUser.Entity.Id;

                var _request = new UserRoleRequest
                {
                    Data = new UserRoleModel
                    {
                        UserID = Convert.ToInt64(Request.QueryString["userid"].ToString())
                    }
                };

                //get Privilege Ids for organization
                var selRoles = new UserRoleHandler(_unitOfWork, _context).GetListData(_request);
                if (selRoles.Entity.RoleIds != null && selRoles.Entity.RoleIds.Count > 0)
                {
                    rpmodel.RoleIds = selRoles.Entity.RoleIds;
                }
            }

            return(View(rpmodel));
        }