Exemple #1
0
        public async Task <IActionResult> RevisionsData(Guid id)
        {
            var languageUid = id;

            if (languageUid.IsEmptyGuid())
            {
                return(NotFound());
            }

            var request = new LanguageRevisionReadListRequest(CurrentUser.Id, languageUid);

            var response = await _languageService.GetLanguageRevisions(request);

            if (response.Status.IsNotSuccess)
            {
                return(NotFound());
            }

            var result = new DataResult();

            result.AddHeaders("revision", "revisioned_by", "revisioned_at", "language_name", "2_char_code", "3_char_code", "icon", "created_at", "");

            for (var i = 0; i < response.Items.Count; i++)
            {
                var revisionItem  = response.Items[i];
                var item          = revisionItem.Item;
                var stringBuilder = new StringBuilder();
                stringBuilder.Append($"{item.Uid}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{revisionItem.Revision}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{revisionItem.RevisionedByName}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{GetDateTimeAsString(revisionItem.RevisionedAt)}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{item.Name}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{item.IsoCode2}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{item.IsoCode3}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{result.PrepareImage($"{item.IconPath}", item.OriginalName)}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{GetDateTimeAsString(item.CreatedAt)}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{result.PrepareRestoreButton("restore", "/Language/Restore/", "/Language/Detail")}{DataResult.SEPARATOR}");

                result.Data.Add(stringBuilder.ToString());
            }

            return(Json(result));
        }
Exemple #2
0
        public async Task <IActionResult> LabelTranslationListData(Guid id, int skip, int take)
        {
            var labelUid = id;

            if (labelUid.IsEmptyGuid())
            {
                return(Forbid());
            }

            var request = new LabelTranslationReadListRequest(CurrentUser.Id, labelUid);

            SetPaging(skip, take, request);

            var response = await _labelService.GetTranslations(request);

            if (response.Status.IsNotSuccess)
            {
                return(NotFound());
            }

            var result = new DataResult();

            result.AddHeaders("language", "translation", "");

            for (var i = 0; i < response.Items.Count; i++)
            {
                var item          = response.Items[i];
                var stringBuilder = new StringBuilder();
                stringBuilder.Append($"{item.Uid}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{result.PrepareImage($"{item.LanguageIconUrl}", item.LanguageName)} {item.LanguageName}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{item.Translation}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{result.PrepareLink($"/Label/LabelTranslationEdit/{item.Uid}", Localizer.Localize("edit"), true)}");
                stringBuilder.Append($"{result.PrepareLink($"/Label/LabelTranslationRevisions/{item.Uid}", Localizer.Localize("revisions_link"), true)}{DataResult.SEPARATOR}");

                result.Data.Add(stringBuilder.ToString());
            }

            result.PagingInfo      = response.PagingInfo;
            result.PagingInfo.Type = PagingInfo.PAGE_NUMBERS;

            return(Json(result));
        }
Exemple #3
0
        public async Task <IActionResult> ListData(int skip, int take)
        {
            var request = new LanguageReadListRequest();

            SetPaging(skip, take, request);

            var response = await _languageService.GetLanguages(request);

            if (response.Status.IsNotSuccess)
            {
                return(NotFound());
            }

            var result = new DataResult();

            result.AddHeaders("language_name", "2_char_code", "3_char_code", "icon", "");

            for (var i = 0; i < response.Items.Count; i++)
            {
                var item          = response.Items[i];
                var stringBuilder = new StringBuilder();
                stringBuilder.Append($"{item.Uid}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{result.PrepareLink("/Language/Detail/" + item.Uid, item.Name, true)}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{item.IsoCode2}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{item.IsoCode3}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{result.PrepareImage($"{item.IconPath}", item.OriginalName)}{DataResult.SEPARATOR}");
                stringBuilder.Append($"{result.PrepareLink("/Language/Edit/" + item.Uid, Localizer.Localize("edit"), true)}{DataResult.SEPARATOR}");

                result.Data.Add(stringBuilder.ToString());
            }

            result.PagingInfo      = response.PagingInfo;
            result.PagingInfo.Type = PagingInfo.PAGE_NUMBERS;

            return(Json(result));
        }