public async Task <ActionResult <RpImportCitizens> > ImportCsv(IFormFile file) { try { if (file != null) { var citizenSqls = new List <CitizenSql>(); try { citizenSqls = ReadCsv(file); } catch (Exception exception) { LoggerStatic.Logger.Warn($"Exception: {exception}"); var exceptionMessage = $"Exception: { exception.Message}"; if (exception.InnerException != null) { exceptionMessage += $" InnerException: { exception.InnerException.Message}"; } return(Json(ResponseHelper.ReturnBadRequest(exceptionMessage))); } await _peopleService.AddCitizens(citizenSqls); var rpImportCitizens = new RpImportCitizens { RecordsAdded = citizenSqls.Count }; return(Json(rpImportCitizens)); //return Json(ResponseHelper.ReturnSuccess()); } return(Json(ResponseHelper.ReturnBadRequest("file == null"))); } catch (Exception exception) { LoggerStatic.Logger.Error($"Exception: {exception}"); return(Json(ResponseHelper.ReturnInternalServerError(exception.Message))); } }