Пример #1
0
        /// <inheritdoc />
        public async Task CreateAsync(string theme, string text)
        {
            byte[] image = _imageService.Get(theme + text);
            Note   note  = new Note(_sessionContext.UserGuid, theme, text, image);
            await _dbContext.Notes.AddAsync(note);

            await _dbContext.SaveChangesAsync();
        }
Пример #2
0
        /// <summary>
        /// Создние тестовой заметки
        /// </summary>
        public Note Create(string theme = "theme", string text = "text")
        {
            var note = new Note
            {
                NoteGuid = Guid.NewGuid(),
                Theme    = theme,
                Text     = text,
                UserGuid = _sessionContex.UserGuid,
                Image    = _uniqueImageService.Get(theme + text)
            };

            _databaseContext.Notes.Add(note);

            return(note);
        }