コード例 #1
0
        public static Chat GetChatById(long currentChatId, LibConfigurationModule config, LibDbContext ctx)
        {
            var chat = ctx.Chats.Where(x => x.СhatId == currentChatId).FirstOrDefault();

            if (chat == null)
            {
                chat = new Chat(currentChatId, config);
                ctx.Chats.Add(chat);
                ctx.SaveChanges();
            }

            BindChatToSchemaHelpers.UpdateChatToSchemasReferences(chat, config);
            return(chat);
        }
コード例 #2
0
 public static void UpdateChatToSchemasReferences(Chat c, LibConfigurationModule config)
 {
     BindChatToSchemaHelpers.BindSchema(c, config);
     BindChatToSchemaHelpers.BindMessageBlock(c, config);
     BindChatToSchemaHelpers.BindMessage(c, config);
 }