public Snippet Create(CreateSnippetRequest request) { Snippet snippet = new Snippet(); int snippetCount = _snippetRepository.GetSnippets().Count(); snippet.Name = request.Name; snippet.CreatorEmail = request.CreatorEmail; snippet.Hash = GenerateHash(snippetCount); snippet.Content = request.Content; snippet.CreationTime = _dateTime.Now.ToString("g"); snippet.LastModified = snippet.CreationTime; _snippetRepository.InsertSnippet(snippet); return(snippet); }
public async Task <IEnumerable <Snippet> > GetSnippetsFromDbAsync(int count) { return(await _snippetRepository.GetSnippets(count)); }
public List <Snippet> GetSnippets() => _snippetRepository.GetSnippets().ToList();