Exemplo n.º 1
0
        public async Task <IActionResult> AddAboutSertificate(string sertificateLabel, IFormFile uploadedSertificate)
        {
            if (uploadedSertificate != null)
            {
                // Определение пути
                string path = _fsContext.GetFSAboutSertificatePath() + uploadedSertificate.FileName;

                // Сохранение файла на сервере
                await _fsContext.AddAboutSertificate(uploadedSertificate);

                // Сохранение в БД
                AboutSertificate newSertificate = new AboutSertificate()
                {
                    SertificateLabel    = sertificateLabel,
                    SertificateFileName = uploadedSertificate.FileName,
                    SertificatePath     = path
                };

                await _db_aboutSertificate.CreateAboutSertificate(newSertificate);
            }
            return(RedirectToAction("Index", "Panel"));
        }
Exemplo n.º 2
0
 // Update
 public async Task UpdateAboutSertificate(AboutSertificate sertificate)
 {
     await AboutSertificateCollection.ReplaceOneAsync(new BsonDocument("_id", new ObjectId(sertificate.Id)), sertificate);
 }
Exemplo n.º 3
0
 // Create
 public async Task CreateAboutSertificate(AboutSertificate sertificate)
 {
     await AboutSertificateCollection.InsertOneAsync(sertificate);
 }