示例#1
0
        public async Task <HfeaForm> Edit(UpdateHfeaFormInput input)
        {
            var originHfeaForm = await _hfeaRepository.GetItemAsync(input.ParentId);

            var publisher = await SessionService.GetPublisherAsync();

            // archive old hfea form

            originHfeaForm.IsActive = false;
            await _hfeaRepository.UpdateItemAsync(input.ParentId, originHfeaForm);

            // Create new version

            var hfeaClassification = input.HfeaClassification.MapTo <HfeaClassification>();
            var hfeaForm           = HfeaForm.Create(
                name: input.Name,
                versionNumber: input.VersionNumber,
                shortDescription: input.ShortDescription,
                publisher: publisher,
                formCode: input.FormCode,
                rootId: originHfeaForm.RootId,
                hfeaFormFile: input.FormFile,
                hfeaClassification: hfeaClassification,
                hfeaDescriptionVideo: input.DescriptionVideo,
                priority: input.Priority,
                useDefaultPriority: input.UseDefaultPriority);

            await _hfeaRepository.CreateItemAsync(hfeaForm);

            return(hfeaForm);
        }
示例#2
0
        public async Task <HfeaForm> Create(CreateHfeaFormInput input)
        {
            var publisher = await SessionService.GetPublisherAsync();

            var hfeaClassification = input.HfeaClassification.MapTo <HfeaClassification>();

            var hfeaForm = HfeaForm.Create(
                name: input.Name,
                versionNumber: input.VersionNumber,
                formCode: input.FormCode,
                shortDescription: input.ShortDescription,
                publisher: publisher,
                hfeaFormFile: input.FormFile,
                hfeaClassification: hfeaClassification,
                hfeaDescriptionVideo: input.DescriptionVideo,
                priority: input.Priority,
                useDefaultPriority: input.UseDefaultPriority);

            await _hfeaRepository.CreateItemAsync(hfeaForm);

            return(hfeaForm);
        }