public async Task <IActionResult> PerformBackup()
        {
            if (string.IsNullOrEmpty(connectionString))
            {
                return(BadRequest("Connection string to database is not set in the configuration file."));
            }
            var response = await service.BackupData(connectionString);

            if (!response.Success)
            {
                return(BadRequest(response.Message));
            }
            return(Ok(true));
        }
Пример #2
0
        public async Task <IActionResult> AdjustDisbursementsForProjects()
        {
            string userIdVal = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            int    userId    = 0;

            if (!string.IsNullOrEmpty(userIdVal))
            {
                userId = Convert.ToInt32(userIdVal);
            }
            if (userId == 0)
            {
                return(BadRequest("Unauthorized user access to api"));
            }
            var result = await backupService.BackupData(connectionString);

            var response = await projectService.AdjustDisbursementsForProjectsAsync(userId);

            if (!response.Success)
            {
                return(BadRequest(response.Message));
            }
            return(Ok(true));
        }