This commit is contained in:
mmrbnjd
2025-08-03 23:01:44 +03:30
parent dace739e46
commit 65eeb4694e
5 changed files with 48 additions and 8 deletions

View File

@@ -272,11 +272,12 @@ namespace Hushian.Application.Services
return Response;
}
public async Task<bool> FinishChat(int ChatID, int CompanyID)
public async Task<bool> FinishChat(int ChatID, int CompanyID,int? ExperID)
{
var convModel = await _ConversationRepository.Get()
.Include(inc => inc.ConversationResponses)
.FirstOrDefaultAsync(w => w.ID == ChatID && w.CompanyID==CompanyID);
if (ExperID.HasValue && !convModel.ConversationResponses.Any(a => a.ExperID == ExperID.Value)) return false;
if (convModel != null && convModel.Status != ConversationStatus.Finished)
{
@@ -293,8 +294,9 @@ namespace Hushian.Application.Services
.Include(inc => inc.ConversationResponses)
.FirstOrDefaultAsync(w =>
w.ID == ChatID
&& w.CompanyID == CompanyID
&& ExperID.HasValue ? w.ConversationResponses.Any(a=>a.ExperID==ExperID.GetValueOrDefault()) :true);
&& w.CompanyID == CompanyID);
if (ExperID.HasValue && !convModel.ConversationResponses.Any(a => a.ExperID == ExperID.Value)) return false;
if (convModel != null && convModel.Status == ConversationStatus.Finished)
{