...
This commit is contained in:
@@ -93,13 +93,89 @@ namespace Hushian.Application.Services
|
||||
|
||||
return Response;
|
||||
}
|
||||
public async Task<List<Read_ConversationDto>> MyConversation(int CompanyID, string UserID)
|
||||
{ return new(); }
|
||||
public async Task<List<Read_ConversationDto>> MyConversationIsFinished(int CompanyID, string? ExperID = null)
|
||||
{ return new(); }
|
||||
public async Task<List<Read_ConversationDto>> MyConversationIsInProgress(int CompanyID, string ExperID)
|
||||
{ return new(); }
|
||||
public async Task<List<Read_ConversationDto>> ConversationAwaitingOurResponse(int CompanyID, string? ExperID = null)
|
||||
{ return new(); }
|
||||
public async Task<List<Read_ConversationDto>> MyConversation(int UserID)
|
||||
=> await _ConversationRepository.Get()
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.UserID == UserID)
|
||||
.Select(s => new Read_ConversationDto()
|
||||
{
|
||||
ExperID = s.ConversationResponses.Last().ExperID,
|
||||
ExperFullName = s.ConversationResponses.Last().Exper.FullName,
|
||||
GroupID = s.GroupID,
|
||||
GroupName = s.Group.Name,
|
||||
LastText = s.ConversationResponses.Last().Text,
|
||||
LastMsgdate = s.Cdatetime.GetDatePersian(),
|
||||
LastMsgtime = s.Cdatetime.GetTime(),
|
||||
LastMsgType = s.ConversationResponses.Last().Type,
|
||||
NoReadCount = s.ConversationResponses.Count(c => !c.IsRead),
|
||||
status = s.Status,
|
||||
UserID = s.UserID,
|
||||
UserFullName = s.User.FullName
|
||||
|
||||
}).ToListAsync();
|
||||
public async Task<List<Read_ConversationDto>> MyConversationIsFinished(int ExperID)
|
||||
=> await _ConversationRepository.Get()
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.ConversationResponses.Any(a=>a.ExperID==ExperID) && w.Status==ConversationStatus.Finished)
|
||||
.Select(s => new Read_ConversationDto()
|
||||
{
|
||||
ExperID = s.ConversationResponses.Last().ExperID,
|
||||
ExperFullName = s.ConversationResponses.Last().Exper.FullName,
|
||||
GroupID = s.GroupID,
|
||||
GroupName = s.Group.Name,
|
||||
LastText = s.ConversationResponses.Last().Text,
|
||||
LastMsgdate = s.Cdatetime.GetDatePersian(),
|
||||
LastMsgtime = s.Cdatetime.GetTime(),
|
||||
LastMsgType = s.ConversationResponses.Last().Type,
|
||||
NoReadCount = s.ConversationResponses.Count(c => !c.IsRead),
|
||||
status = s.Status,
|
||||
UserID = s.UserID,
|
||||
UserFullName = s.User.FullName
|
||||
|
||||
}).ToListAsync();
|
||||
public async Task<List<Read_ConversationDto>> MyConversationIsInProgress(int ExperID)
|
||||
=> await _ConversationRepository.Get()
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.ConversationResponses.Any(a => a.ExperID == ExperID) && w.Status == ConversationStatus.InProgress)
|
||||
.Select(s => new Read_ConversationDto()
|
||||
{
|
||||
ExperID = s.ConversationResponses.Last().ExperID,
|
||||
ExperFullName = s.ConversationResponses.Last().Exper.FullName,
|
||||
GroupID = s.GroupID,
|
||||
GroupName = s.Group.Name,
|
||||
LastText = s.ConversationResponses.Last().Text,
|
||||
LastMsgdate = s.Cdatetime.GetDatePersian(),
|
||||
LastMsgtime = s.Cdatetime.GetTime(),
|
||||
LastMsgType = s.ConversationResponses.Last().Type,
|
||||
NoReadCount = s.ConversationResponses.Count(c => !c.IsRead),
|
||||
status = s.Status,
|
||||
UserID = s.UserID,
|
||||
UserFullName = s.User.FullName
|
||||
|
||||
}).ToListAsync();
|
||||
public async Task<List<Read_ConversationDto>> ConversationAwaitingOurResponse(int CompanyID)
|
||||
=> await _ConversationRepository.Get()
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.ConversationResponses.Any(a => !a.ExperID.HasValue) && w.CompanyID == CompanyID)
|
||||
.Select(s => new Read_ConversationDto()
|
||||
{
|
||||
ExperID = s.ConversationResponses.Last().ExperID,
|
||||
ExperFullName = s.ConversationResponses.Last().Exper.FullName,
|
||||
GroupID = s.GroupID,
|
||||
GroupName = s.Group.Name,
|
||||
LastText = s.ConversationResponses.Last().Text,
|
||||
LastMsgdate = s.Cdatetime.GetDatePersian(),
|
||||
LastMsgtime = s.Cdatetime.GetTime(),
|
||||
LastMsgType = s.ConversationResponses.Last().Type,
|
||||
NoReadCount = s.ConversationResponses.Count(c => !c.IsRead),
|
||||
status = s.Status,
|
||||
UserID = s.UserID,
|
||||
UserFullName = s.User.FullName
|
||||
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user