Beispiel #1
0
        public async Task <IActionResult> LabelTranslationCreate(LabelTranslationCreateModel model)
        {
            if (model.IsNotValid())
            {
                model.SetInputModelValues();
                return(View(model));
            }

            var request = new LabelTranslationCreateRequest(CurrentUser.Id, model.OrganizationUid, model.LabelUid,
                                                            model.LanguageUid, model.LabelTranslation);

            var response = await _labelService.CreateTranslation(request);

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

            CurrentUser.IsActionSucceed = true;
            return(Redirect($"/Label/Detail/{response.Item.LabelUid}"));
        }
Beispiel #2
0
        public static LabelTranslationCreateModel MapLabelTranslationCreateModel(LabelDto label)
        {
            var model = new LabelTranslationCreateModel();

            model.OrganizationUid = label.OrganizationUid;

            model.ProjectUid  = label.ProjectUid;
            model.ProjectName = label.ProjectName;

            model.LabelUid = label.Uid;
            model.LabelKey = label.Key;

            model.SetInputModelValues();
            return(model);
        }