Esempio n. 1
0
        public async Task <IActionResult> Clone(LabelCloneModel model)
        {
            if (model.IsNotValid())
            {
                model.SetInputModelValues();
                return(View(model));
            }

            var request = new LabelCloneRequest(CurrentUser.Id, model.OrganizationUid, model.CloningLabelUid,
                                                model.ProjectUid, model.Key, model.Description);
            var response = await _labelService.CloneLabel(request);

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

            CurrentUser.IsActionSucceed = true;
            return(Redirect($"/Label/Detail/{response.Item.Uid}"));
        }
Esempio n. 2
0
        public static LabelCloneModel MapLabelCloneModel(LabelDto dto)
        {
            var model = new LabelCloneModel();

            model.OrganizationUid              = dto.OrganizationUid;
            model.CloningLabelUid              = dto.Uid;
            model.CloningLabelKey              = dto.Key;
            model.CloningLabelDescription      = dto.Description;
            model.CloningLabelTranslationCount = dto.LabelTranslationCount;

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