public async Task<string> Save(string deckId, Deck deck) { var filename = string.Format("{0}.json", deckId); var json = JsonConvert.SerializeObject(deck); var data = Encoding.ASCII.GetBytes(json); await _storage.WriteAsync(filename, data); return deckId; }
public string Save(string deckId, Deck deck) { var filename = string.Format("{0}{1}.json", _filePath, deckId); var json = JsonConvert.SerializeObject(deck); var data = Encoding.ASCII.GetBytes(json); File.WriteAllText(filename, json); return deckId; }
public async Task<string> New(Deck deck) { var deckId = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()); await Save(deckId, deck); return deckId; }
public string New(Deck deck) { var deckId = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()); Save(deckId, deck); return deckId; }