/// <summary> Makes a new word in Frontier that has deleted tag on each sense </summary> /// <returns> A bool: success of operation </returns> public async Task <bool> Delete(string projectId, string wordId) { var wordIsInFrontier = await _wordRepo.DeleteFrontier(projectId, wordId); // We only want to add the deleted word if the word started in the frontier. if (wordIsInFrontier) { var wordToDelete = await _wordRepo.GetWord(projectId, wordId); if (wordToDelete is null) { return(false); } wordToDelete.Id = ""; wordToDelete.Modified = ""; wordToDelete.History = new List <string> { wordId }; wordToDelete.Accessibility = State.Deleted; foreach (var senseAcc in wordToDelete.Senses) { senseAcc.Accessibility = State.Deleted; } await _wordRepo.Create(wordToDelete); } return(wordIsInFrontier); }
/// <summary> Makes a new word in Frontier that has deleted tag on each sense </summary> /// <returns> A bool: success of operation </returns> public async Task <bool> Delete(string projectId, string wordId) { var wordIsInFrontier = _repo.DeleteFrontier(projectId, wordId).Result; // We only want to add the deleted word if the word started in the frontier if (wordIsInFrontier) { var wordToDelete = _repo.GetWord(projectId, wordId).Result; wordToDelete.Id = ""; wordToDelete.History = new List <string>() { wordId }; foreach (var senseAcc in wordToDelete.Senses) { senseAcc.Accessibility = (int)State.Deleted; } await _repo.Create(wordToDelete); } return(wordIsInFrontier); }
public async Task <IActionResult> DeleteFrontier(string projectId, string wordId) { #if DEBUG if (!_permissionService.HasProjectPermission(Permission.WordEntry, HttpContext)) { return(new ForbidResult()); } // Ensure project exists var project = _projectService.GetProject(projectId); if (project == null) { return(new NotFoundObjectResult(projectId)); } if (await _repo.DeleteFrontier(projectId, wordId)) { return(new OkResult()); } return(new NotFoundResult()); #else return(new NotFoundResult()); #endif }