Ejemplo n.º 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);
        }
 public static void UpdateChatToSchemasReferences(Chat c, LibConfigurationModule config)
 {
     BindChatToSchemaHelpers.BindSchema(c, config);
     BindChatToSchemaHelpers.BindMessageBlock(c, config);
     BindChatToSchemaHelpers.BindMessage(c, config);
 }