Example #1
0
        public async Task <IActionResult> DeleteProject(string id)
        {
            GoNorthProject project = await _projectDbAccess.GetProjectById(id);

            if (project.IsDefault)
            {
                return(BadRequest(_localizer["ProjectIsDefaultProject"].Value));
            }

            bool isProjectEmpty = await IsProjectEmpty(project);

            if (!isProjectEmpty)
            {
                _logger.LogInformation("Attempted to delete non empty project {0}.", project.Name);
                return(BadRequest(_localizer["ProjectNotEmpty"].Value));
            }

            await _projectDbAccess.DeleteProject(project);

            _logger.LogInformation("Project was deleted.");

            await CleanUpAdditionalProjectData(project);

            _logger.LogInformation("Additional project data was deleted.");

            await _timelineService.AddTimelineEntry(null, TimelineEvent.ProjectDeleted, project.Name);

            return(Ok(id));
        }
Example #2
0
        public async Task <IActionResult> DeleteProject(string id)
        {
            GoNorthProject project = await _projectDbAccess.GetProjectById(id);

            bool isProjectEmpty = await IsProjectEmpty(project);

            if (!isProjectEmpty)
            {
                _logger.LogInformation("Attempted to delete non empty project {0}.", project.Name);
                return(StatusCode((int)HttpStatusCode.BadRequest, _localizer["ProjectNotEmpty"].Value));
            }

            await _projectDbAccess.DeleteProject(project);

            _logger.LogInformation("Project was deleted.");

            await _timelineService.AddTimelineEntry(TimelineEvent.ProjectDeleted, project.Name);

            return(Ok(id));
        }