示例#1
0
        /// <summary>
        /// Удаляет заявление о приёме
        /// </summary>
        /// <param name="entry"></param>
        /// <returns></returns>
        public async Task RemoveApplicationForAdmissionAsync(ApplicationForAdmission entry)
        {
            if (entry.FileModelId != null)
            {
                await _fileModelRepository.RemoveFileModelAsync(entry.FileModel);
            }

            _context.ApplicationForAdmissions.Remove(entry);
            await _context.SaveChangesAsync();
        }
示例#2
0
        /// <summary>
        /// Создаёт заявление о приёме
        /// </summary>
        /// <param name="applicationForAdmission"></param>
        /// <param name="uploadedFile"></param>
        /// <returns></returns>
        public async Task CreateApplicationForAdmissionAsync(ApplicationForAdmission applicationForAdmission, IFormFile uploadedFile)
        {
            if (uploadedFile != null)
            {
                var loadedFileModel = await _fileModelRepository.UploadApplicationForAdmissionFileAsync(uploadedFile);

                applicationForAdmission.FileModel   = loadedFileModel;
                applicationForAdmission.FileModelId = loadedFileModel.Id;
            }

            _context.ApplicationForAdmissions.Add(applicationForAdmission);
            await _context.SaveChangesAsync();
        }
示例#3
0
        /// <summary>
        /// Обновляет заявление о приёме
        /// </summary>
        /// <param name="applicationForAdmission"></param>
        /// <param name="uploadedFile"></param>
        /// <returns></returns>
        public async Task UpdateApplicationForAdmissionAsync(ApplicationForAdmission applicationForAdmission, IFormFile uploadedFile)
        {
            if (uploadedFile != null)
            {
                if (applicationForAdmission.FileModelId == null)
                {
                    var newFileModel = await _fileModelRepository.UploadApplicationForAdmissionFileAsync(uploadedFile);

                    applicationForAdmission.FileModelId = newFileModel.Id;
                }
                else
                {
                    if (applicationForAdmission.FileModel == null)
                    {
                        applicationForAdmission.FileModel = await _fileModelRepository.GetFileModelAsync(applicationForAdmission.FileModelId);
                    }

                    await _fileModelRepository.ReloadFileAsync(applicationForAdmission.FileModel, uploadedFile);
                }
            }

            await UpdateApplicationForAdmissionAsync(applicationForAdmission);
        }
示例#4
0
 /// <summary>
 /// Обновляет заявление о зачислении
 /// </summary>
 /// <param name="applicationForAdmission"></param>
 /// <returns></returns>
 public async Task UpdateApplicationForAdmissionAsync(ApplicationForAdmission applicationForAdmission)
 {
     _context.ApplicationForAdmissions.Update(applicationForAdmission);
     await _context.SaveChangesAsync();
 }