コード例 #1
0
        public IHttpActionResult GetAdminUsers()
        {
            var data     = "";
            var identity = MyAuthorizationServerProvider.AuthenticateUser();

            if (identity != null)
            {
                UserBO objUser = new UserBO();

                if (identity.Role == ConstantMessages.Roles.companyadmin || identity.Role == ConstantMessages.Roles.superadmin)
                {
                    objUser.UserID = identity.UserID;
                    objUser.CompId = identity.CompId;
                    objUser.Role   = identity.Role;

                    var ds = OrganizationBL.GetAdminUsers(objUser);
                    if (ds.Tables.Count > 0)
                    {
                        data = Utility.ConvertDataSetToJSONString(ds.Tables[0]);
                        data = Utility.Successful(data);
                    }
                    else
                    {
                        data = Utility.API_Status("2", "No user found");
                    }
                }
                else
                {
                    data = Utility.API_Status("3", "You do not have access for this functionality");
                }
            }
            else
            {
                data = Utility.AuthenticationError();
            }
            return(new APIResult(Request, data));
        }