Esempio n. 1
0
 public void Create(Snippet snippet)
 {
     foreach (var file in snippet.Files)
     {
         _snippetFileRepository.InsertSnippetFile(file);
     }
     snippet.Hash           = GenerateHash(snippet.Name);
     snippet.CreationTime   = _dateTime.Now.ToString("g");
     snippet.ExpirationTime = _dateTime.Now.AddMinutes(10).ToString("g");
     _snippetRepository.InsertSnippet(snippet);
 }
Esempio n. 2
0
        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);
        }