コード例 #1
0
        public Tag CreateTag(string name, IEnumerable <string> values)
        {
            var state = _database.CreateTag(name);

            values.ForEach(value => _database.AddValue(state, value));
            return(_tagFactory.Create(state));
        }
コード例 #2
0
ファイル: SpiralLayouter.cs プロジェクト: ToshchevIvan/di
 public IEnumerable <ITag> GetLayout(IDictionary <string, Style> styledStrings)
 {
     foreach (var item in styledStrings)
     {
         var location = PutNextRectangle(item.Value.Size).Location;
         yield return(tagFactory.Create(item.Key, item.Value, location));
     }
 }
コード例 #3
0
        public async Task Create(string tag, [Remainder] string msg)
        {
            if (msg.Length > 200)
            {
                await ReplyAsync("The length of the message can be up to 200 characters");

                return;
            }
            var count = await _tag.GetAll().Where(f => f.UserId == Context.User.Id && f.Name == tag).CountDocumentsAsync();

            if (count >= 10)
            {
                await ReplyAsync("You can only have 10 tags");

                return;
            }
            await _tag.Create(_tagFactory.Create(Context.User.Id, tag, msg));

            await ReplyAsync($"Created tag **{tag}** successfully!");
        }