public async Task <IActionResult> DeleteProject(int id)
        {
            var project = await _projectManagerRepository.GetProjectByIdAsync(id, true);

            if (project == null)
            {
                _logger.LogInformation($"No project found with id {id}");
                return(NotFound());
            }

            _projectManagerRepository.DeleteProject(project);

            if (!await _projectManagerRepository.SaveAsync())
            {
                _logger.LogError($"An error occured deleting project id: {id}");
                return(StatusCode(500, "A problem happened while handling your request."));
            }

            return(NoContent());
        }
Esempio n. 2
0
 public IActionResult Delete(Project project)
 {
     projectManagerRepository.DeleteProject(project);
     return(View());
 }