Exemple #1
0
        public async void EditSave()
        {
            MainViewModel main = IoC.Get <MainViewModel>();

            if (!await ValidateAsync())
            {
                await main.Notify("项目信息验证失败", NotificationType.Warning);

                return;
            }

            CodeProjectInputDto dto    = this.MapTo <CodeProjectInputDto>();
            OperationResult     result = null;
            await _serviceProvider.ExecuteScopedWorkAsync(async provider =>
            {
                IDataContract contract = provider.GetRequiredService <IDataContract>();
                result = dto.Id == default
                    ? await contract.CreateCodeProjects(dto)
                    : await contract.UpdateCodeProjects(dto);
            });

            Helper.Notify(result);
            if (!result.Succeeded)
            {
                return;
            }

            ProjectListViewModel list = main.ProjectList;

            list.EditingModel = null;
            list.IsShowEdit   = false;
            list.Init();
        }
Exemple #2
0
        public void Edit()
        {
            ProjectListViewModel model = IoC.Get <ProjectListViewModel>();

            model.EditingModel = this;
            model.EditTitle    = $"项目编辑 - {Name}";
            model.IsShowEdit   = true;
        }
Exemple #3
0
        public void New()
        {
            ProjectListViewModel model = IoC.Get <ProjectListViewModel>();

            model.EditingModel = IoC.Get <ProjectViewModel>();
            model.EditTitle    = "新增项目";
            model.IsShowEdit   = true;
        }