Example #1
0
        public static LabelTranslationEditModel MapLabelTranslationEditModel(LabelTranslationDto dto)
        {
            var model = new LabelTranslationEditModel();

            model.LabelTranslationUid    = dto.Uid;
            model.Translation            = dto.Translation;
            model.TranslationInput.Value = dto.Translation;
            model.LabelKey        = dto.LabelKey;
            model.LanguageName    = dto.LanguageName;
            model.LanguageIconUrl = dto.LanguageIconUrl;

            model.OrganizationUid = dto.OrganizationUid;
            model.SetInputModelValues();

            return(model);
        }
Example #2
0
        public async Task <IActionResult> LabelTranslationEdit(LabelTranslationEditModel model)
        {
            if (model.IsNotValid())
            {
                model.SetInputModelValues();
                return(View(model));
            }

            var request  = new LabelTranslationEditRequest(CurrentUser.Id, model.OrganizationUid, model.LabelTranslationUid, model.Translation);
            var response = await _labelService.EditTranslation(request);

            if (response.Status.IsNotSuccess)
            {
                model.MapMessages(response);
                model.SetInputModelValues();
                return(View(model));
            }

            CurrentUser.IsActionSucceed = true;
            return(Redirect($"/Label/Detail/{response.Item.LabelUid}"));
        }