public void SaveStringInversionToDatabase(string words, string result) { StringInversion invert = new StringInversion(); invert.String = words; invert.Result = result; _context.StringInversions.Add(invert); _context.SaveChanges(); }
public void SaveSortingToDatabase(List <char> unordered, List <char> ordered) { SortingInput UnorderedCollection = new SortingInput(); SortingOutput OrderedCollection = new SortingOutput(); int i = 1; foreach (char character in unordered) { UnorderedCollection.InputCharacterCollection.Add(new SortingValuesForInput(i, character)); i++; } foreach (char letter in ordered) { OrderedCollection.OutputCharacterCollection.Add(new SortingValuesForOutput(letter)); } _context.InputtedCharacters.Add(UnorderedCollection); _context.OutputtedCharacters.Add(OrderedCollection); // _context.CharacterSortingOutputs.Add(sortOut); _context.SaveChanges(); }