using Chatbot.Api.Domain.Data.DbContexts; using Chatbot.Api.Domain.Entities; using Chatbot.Api.Domain.Repositories; using System; using System.Threading.Tasks; namespace Chatbot.Api.Domain.Data.Repositories { public class SessionRepository : ISessionRepository { private readonly SessionDbContext _dbContext; public SessionRepository(SessionDbContext dbContext) { _dbContext = dbContext; } public async Task CreateSession(Guid botId, string clientApplication, string externalId, string userKey) { var session = new BotSession() { SessionId = Guid.NewGuid(), StartDate = DateTime.Now, BotId = botId, ClientApplication = clientApplication, ExternalId = externalId, UserKey = userKey }; _dbContext.Add(session); await _dbContext.SaveChangesAsync(); return session; } } }