public static void FormatPhrase(PhraseItem phrase) { var newPhrase = FormatPhrase(phrase.Phrase); var newDescription = FormatDescription(phrase.Description); phrase.Phrase = newPhrase; phrase.Description = newDescription; }
public async Task <string> AddPhraseAsync(int packId, PhraseItem phrase, string author) { if (phrase.Complexity < 1 || String.IsNullOrWhiteSpace(phrase.Description)) { return(await GetResponseAsync($"addPackWord?id={packId}&word={phrase.Phrase}&author={author}", 8091) .ConfigureAwait(false)); } return(await GetResponseAsync( $"addPackWordDescription?id={packId}&word={phrase.Phrase}&description={phrase.Description.ReplaceSemicolons()}&level={phrase.Complexity}&author={author}", 8091).ConfigureAwait(false)); }
public void EditPhrase(int packId, PhraseItem oldPhrase, PhraseItem newPhrase, string selectedAuthor) { if (oldPhrase.Phrase != newPhrase.Phrase) { DeletePhrase(packId, oldPhrase.Phrase, selectedAuthor); } if (!string.Equals(oldPhrase.Phrase, newPhrase.Phrase, StringComparison.Ordinal) || Math.Abs(oldPhrase.Complexity - newPhrase.Complexity) > 0.01 || !string.Equals(oldPhrase.Description, newPhrase.Description, StringComparison.Ordinal)) { GetResponse( $"addPackWordDescription?id={packId}&word={newPhrase.Phrase}&description={newPhrase.Description.ReplaceSemicolons()}&level={newPhrase.Complexity}&author={selectedAuthor}", 8091); } }
public PhraseItem Clone() { var phrase = new PhraseItem { Phrase = Phrase, Complexity = Complexity, Description = Description, ReviewerObjects = new Reviewer[ReviewerObjects.Length] }; for (var i = 0; i < ReviewerObjects.Length; i++) { phrase.ReviewerObjects[i] = new Reviewer(ReviewerObjects[i].Author, ReviewerObjects[i].ReviewState); } return(phrase); }
public async Task <string> EditPhraseAsync(int packId, PhraseItem oldPhrase, PhraseItem newPhrase, string selectedAuthor) { if (oldPhrase.Phrase != newPhrase.Phrase) { await DeletePhraseAsync(packId, oldPhrase.Phrase, selectedAuthor).ConfigureAwait(false); } if (!string.Equals(oldPhrase.Phrase, newPhrase.Phrase, StringComparison.Ordinal) || Math.Abs(oldPhrase.Complexity - newPhrase.Complexity) > 0.01 || !string.Equals(oldPhrase.Description, newPhrase.Description, StringComparison.Ordinal)) { return(await GetResponseAsync( $"addPackWordDescription?id={packId}&word={newPhrase.Phrase}&description={newPhrase.Description.ReplaceSemicolons()}&level={newPhrase.Complexity}&author={selectedAuthor}", 8091).ConfigureAwait(false)); } return(await new Task <string>(() => "").ConfigureAwait(false)); }
public Task ReviewPhraseAsync(int packId, PhraseItem phrase, string reviewerName, State state) { return(GetResponseAsync($"reviewPackWord?id={packId}&word={phrase.Phrase}&author={reviewerName}&state={(int)state}", 8091)); }
public void ReviewPhrase(int packId, PhraseItem phrase, string reviewerName, State state) { GetResponse($"reviewPackWord?id={packId}&word={phrase.Phrase}&author={reviewerName}&state={(int)state}", 8091); }
public void AddPhrase(int packId, PhraseItem phrase) { GetResponse( $"addPackWordDescription?id={packId}&word={phrase.Phrase}&description={phrase.Description.ReplaceSemicolons()}&level={phrase.Complexity}&author={phrase.ReviewedBy}", 8091); }