public async Task <IActionResult> DeleteConfirmed(int id)
        {
            DocumentInfo document = _dataAccess.Document.FirstOrDefault(id);

            _dataAccess.Document.Delete(document);
            _storage[id].Clear();

            _dataAccess.Save();

            Employee employee = await GetCurrentUserAsync();

            _logger.LogInformation($"Подтверждение на удаление {document}. Документ успешно удален [{employee.FullName}({employee.Email})]");

            return(RedirectToAction(nameof(List)));
        }
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DocumentInfo document = _dataAccess.Document.FirstOrDefault(id.Value);

            if (document == null)
            {
                return(NotFound());
            }

            return(View(document));
        }
        public async Task <IActionResult> Acquainted(int id)
        {
            DocumentInfo document = _dataAccess.Document.FirstOrDefault(id);

            Familiarization familiarization = new Familiarization
            {
                Employee = await GetCurrentUserAsync(),
                DateTime = DateTime.Now
            };

            document.Familiarizations.Add(familiarization);

            _dataAccess.Document.Update(document);

            _dataAccess.Save();

            _logger.LogInformation($"С {document} ознакомился [{familiarization.Employee}] ");

            return(RedirectToAction(nameof(List)));
        }
        public async Task <IActionResult> Create(DocumentViewModel document)
        {
            if (!ModelState.IsValid)
            {
                return(View(document));
            }

            DocumentInfo info = _mapper.Map <DocumentInfo>(document);

            info.Employee = await GetCurrentUserAsync();

            info.CreatedAt = DateTime.Now;

            _dataAccess.Document.Create(info);
            _dataAccess.Save();

            _logger.LogInformation($"Создан {info}");

            _storage[info.Id].AddFormFiles(document.Files);

            return(RedirectToAction(nameof(List)));
        }
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DocumentInfo document = _dataAccess.Document.FirstOrDefault(id.Value);

            if (document == null)
            {
                return(NotFound());
            }

            Employee employee = await GetCurrentUserAsync();

            bool isFamiliarized = document.Familiarizations.Any(f => f.Employee.Id == employee.Id);

            return(View(new DetailsViewModel {
                Document = document, СurrentUserIsFamiliarized = isFamiliarized || document.SeeBefore < DateTime.Now
            }));
        }