コード例 #1
0
        public async Task<DataSourceResult> GetAll(DataSourceRequest command)
        {
            try
            {
                
                IEnumerable languages = await LanguageBll.GetPaging(command.PageSize, command.PageNumber, "", command.Keyword);
                var gridModel = new DataSourceResult
                                {
                                    Data = languages,
                                    Total =(int)( await LanguageBll.GetTotal(command.Keyword))
                                };
                return await Task.FromResult(gridModel);
            }
            catch (Exception ex)
            {

                ErrorStore.LogExceptionWithoutContext(ex);
                return new DataSourceResult();
            }
        }
コード例 #2
0
        public async Task<DataSourceResult> GetCultures()
        {
            try
            {
                List<SelectListItemModel> data = new List<SelectListItemModel>();
                var cultures = System.Globalization.CultureInfo.GetCultures(
                    System.Globalization.CultureTypes.SpecificCultures)
                    .OrderBy(x => x.EnglishName);
                foreach(var item in cultures)
                {
                    var model = new SelectListItemModel {
                        Text = item.EnglishName,
                        Value = item.IetfLanguageTag
                    };
                    data.Add(model);
                }
                var gridModel = new DataSourceResult
                {
                    Data = data,
                    Total = cultures.Count()
                };
                return await Task.FromResult(gridModel);
            }
            catch (Exception ex)
            {

                ErrorStore.LogExceptionWithoutContext(ex);
                return new DataSourceResult();
            }
        }