Esempio n. 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);
        }