Пример #1
0
        public JqGridResultViewModel <ClientViewModel> GetWebApiClients(JqGridSearchModel jqGridSearchModel)
        {
            try
            {
                if (jqGridSearchModel != null)
                {
                    List <ClientViewModel> model = new List <ClientViewModel>();

                    JqGridPaging <DAL.Models.Authentication.Client, ClientViewModel> JqGridPaging = new JqGridPaging <DAL.Models.Authentication.Client, ClientViewModel>(unitOfWork.ClientRepository.GetAllQueryable(), "ClientId", jqGridSearchModel);
                    var clients = JqGridPaging.GetResult();

                    if (clients != null)
                    {
                        foreach (var client in clients)
                        {
                            model.Add(new ClientViewModel(client));
                        }
                    }

                    return(JqGridPaging.GetJqGridResult(model));
                }
                return(null);
            }
            catch (Exception e)
            {
                LogError("GetWebApiClients", e);
                Trace.TraceError(string.Format("GetWebApiClients in account service error: {0}", e.Message));
                throw e;
            }
        }
        public JqGridResultViewModel <UserViewModel> GetUsers(JqGridSearchModel jqGridSearchModel)
        {
            try
            {
                //TODO add support for join query
                if (jqGridSearchModel != null)
                {
                    List <UserViewModel> model = new List <UserViewModel>();


                    JqGridPaging <User, UserViewModel> JqGridPaging = new JqGridPaging <User, UserViewModel>(unitOfWork.UserRepository.GetAllQueryable(), "Id", jqGridSearchModel);
                    var users = JqGridPaging.GetResult();
                    var test  = UserManager.Users.ToList();

                    if (users != null)
                    {
                        foreach (var user in users)
                        {
                            model.Add(new UserViewModel(user));
                        }
                    }

                    return(JqGridPaging.GetJqGridResult(model));
                }
                return(null);
            }
            catch (Exception e)
            {
                LogError("GetUsers", e);

                Trace.TraceError("GetUsers in user service error : {0}", e.Message);
                throw e;
            }
        }
Пример #3
0
        public JqGridResultViewModel <RefreshTokenViewModel> GetClientUsersRefreshTokens(Guid clientId, JqGridSearchModel jqGridSearchModel = null)
        {
            try
            {
                if (jqGridSearchModel != null)
                {
                    List <RefreshTokenViewModel> model = new List <RefreshTokenViewModel>();

                    JqGridPaging <RefreshToken, RefreshTokenViewModel> JqGridPaging = new JqGridPaging <RefreshToken, RefreshTokenViewModel>(unitOfWork.RefreshTokenRepository.GetAllQueryable(), "RefreshTokenId", jqGridSearchModel, "ClientId", clientId);
                    var refreshTokens = JqGridPaging.GetResult();

                    if (refreshTokens != null)
                    {
                        foreach (var token in refreshTokens)
                        {
                            model.Add(new RefreshTokenViewModel(token));
                        }
                    }

                    return(JqGridPaging.GetJqGridResult(model));
                }
                return(null);
            }
            catch (Exception e)
            {
                LogError("GetClientUsersRefreshTokens", e);
                Trace.TraceError("GetClientUsersRefreshTokens in webapi service error : {0}", e.Message);
                throw e;
            }
        }