BotSharp/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.UpdateAgent.cs

21 lines
562 B
C#
Raw Normal View History

2023-06-23 04:43:00 +00:00
using BotSharp.Abstraction.Agents.Models;
namespace BotSharp.Core.Agents.Services;
public partial class AgentService
{
public async Task UpdateAgent(Agent agent)
{
2023-06-26 23:08:24 +00:00
var db = _services.GetRequiredService<AgentDbContext>();
db.Transaction<IAgentTable>(delegate
{
var record = db.Agent.FirstOrDefault(x => x.OwnerId == agent.OwerId && x.Id == agent.Id);
record.Name = agent.Name;
record.Description = agent.Description;
record.UpdatedDateTime = DateTime.UtcNow;
});
2023-06-23 04:43:00 +00:00
}
}