예제 #1
0
        public async Task <IActionResult> Import(IFormFile file, ImportModel model)
        {
            try
            {
                using var stream = file.OpenReadStream();

                await _importService.CreateImportPreview(stream, model);

                return(View("ImportResult", model));
            }
            catch (NotFoundException exc)
            {
                Log.Error(exc, "Exception during Import");

                TempDataHelper.SetTemporaryMessage(TempData, MessageState.Error, message: Resources.BankAccountNotFound);
                return(RedirectToAction("Index"));
            }
            catch (ImportFileException exc)
            {
                Log.Error(exc, "Exception during Import");

                TempDataHelper.SetTemporaryMessage(TempData, MessageState.Error, message: Resources.ErrorWhileProcessingImport);
                return(RedirectToAction("Index"));
            }
            catch (Exception exc)
            {
                Log.Error(exc, "Exception during Import");

                TempDataHelper.SetTemporaryMessage(TempData, MessageState.Error, message: Resources.Error);
                return(RedirectToAction("Index"));
            }
        }