コード例 #1
0
        public async Task <Message> GetModuleBySearchString([FromBody] Dictionary <string, object> dictionary)
        {
            if (!dictionary.ContainsKey("moduleName"))
            {
                return(Message.Fail().Add("content", "参数错误"));
            }
            string modulename = (string)dictionary["moduleName"];
            var    items      = await _moduleRepository.FindBy(x => x.ModuleName.Contains(modulename)).ToListAsync();

            // var results = _mapper.Map<IEnumerable<UserView>>(items);
            return(Message.Ok().Add("moduleList", items));
        }
コード例 #2
0
        public IPagedList <ModuleDTO> FindBy(string name, int pageNumber, int pageSize)
        {
            var list = _Repository.FindBy(name, pageNumber, pageSize);

            var result = list.OrderBy(x => x.SortOrder).ToList();

            return(new StaticPagedList <ModuleDTO>(
                       result.Select(x => x.ToDto()),
                       pageNumber,
                       pageSize,
                       list.TotalItemCount));
        }
コード例 #3
0
        public GetModuleResponse GetModule(GetModuleRequest request)
        {
            GetModuleResponse response = new GetModuleResponse();

            try
            {
                Module module = _moduleRepository.FindBy(request.ModuleId);
                response.ModuleView = module.ConverToModuleView();
            }
            catch (Exception ex)
            {
                string message = "查询失败!错误信息:/n" + ex.Message;
                response = new GetModuleResponse()
                {
                    ResponseSucceed = false,
                    Message         = "查询失败"
                };
                LoggingFactory.GetLogger().WriteDebugLogger(message);

                return(response);
            }

            return(response);
        }