Exemplo n.º 1
0
        public async Task <Snippet> AddSnippet(string name, string description, string code, User author, Language language, ICollection <Tag> tags)
        {
            var snippet = new Snippet()
            {
                Name        = name,
                Description = description,
                Code        = code,
                Language    = language,
                Author      = _userRepository.GetById(author.Id)
            };


            snippet = await _snippetRepository.AddAsync(snippet);

            await _snippetRepository.CommitAsync();

            snippet.SnippetTags = await BindTagsToSnippet(snippet, tags);

            return(snippet);
        }