public async Task Clone_POST_InvalidModel()
        {
            // arrange
            var model = new ProjectCloneModel();

            // act
            var result = await SystemUnderTest.Clone(model);

            // assert
            AssertInputErrorMessagesOfView(result, model);
        }
示例#2
0
        public static ProjectCloneModel GetOrganizationOneProjectOneCloneModel()
        {
            var model = new ProjectCloneModel();

            model.OrganizationUid       = OrganizationOneUid;
            model.Name                  = OrganizationOneProjectOneName;
            model.CloningProjectUid     = OrganizationOneProjectOneUid;
            model.LabelCount            = One;
            model.LabelTranslationCount = Two;
            model.Url = HttpsUrl;

            return(model);
        }
示例#3
0
        public static ProjectCloneModel MapProjectCloneModel(ProjectDto dto)
        {
            var model = new ProjectCloneModel();

            model.OrganizationUid   = dto.OrganizationUid;
            model.CloningProjectUid = dto.Uid;
            model.Name = dto.Name;

            model.Url         = dto.Url;
            model.Description = dto.Description;

            model.LabelCount            = dto.LabelCount;
            model.LabelTranslationCount = dto.LabelTranslationCount;
            model.IsSuperProject        = dto.IsSuperProject;

            model.SetInputModelValues();
            return(model);
        }
示例#4
0
        public async Task <IActionResult> Clone(ProjectCloneModel model)
        {
            if (model.IsNotValid())
            {
                model.SetInputModelValues();
                return(View(model));
            }

            var request = new ProjectCloneRequest(CurrentUser.Id, model.OrganizationUid, model.CloningProjectUid,
                                                  model.Name, model.Url, model.Description,
                                                  model.LabelCount, model.LabelTranslationCount, model.IsSuperProject);
            var response = await _projectService.CloneProject(request);

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

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