public async Task <IActionResult> Delete(string projectId) { var projectFromStorage = await _projectsService.GetProjectAsync(projectId); if (projectFromStorage == null) { return(NotFound()); } var authorization = await _authorizationService.AuthorizeAsync(User, projectFromStorage, Operations.Delete); if (!authorization.Succeeded) { return(Forbid()); } var branches = await _branchesService.GetBranchesAsync(projectId); foreach (var branch in branches) { await _searchService.DeleteDocumentsAsync(projectId, branch.Name); } await _projectsService.DeleteProjectAsync(projectId); return(Ok()); }
public async Task <IActionResult> DeleteProject(int id) { await _projectsService.DeleteProjectAsync(id); return(RedirectToAction("ProjectsAdmin")); }
public async Task <ProjectDto> DeleteProjectAsync(ApplicationUser user, long projectId, CancellationToken cancellationToken = default) { var project = await _projectsService.DeleteProjectAsync(user, projectId, cancellationToken); return(project == null ? null : _mapper.Map <ProjectDto>(project)); }
public async Task <IActionResult> Delete(string projectId) { await _projectsService.DeleteProjectAsync(projectId); return(Ok()); }