mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
optimization sql
This commit is contained in:
@@ -52,13 +52,13 @@ public class InviteUserController : Controller
|
||||
_logger.LogInformation("Getting all active invitations by administrator");
|
||||
|
||||
var read = await _repository.GetAllAsync();
|
||||
var result = read.Where(x => x.IsActive == true).ToList();
|
||||
var result = read.Where(x => x.IsActive).ToList();
|
||||
|
||||
List<InvitationDto> dtos = new List<InvitationDto>();
|
||||
List<InvitationResponses> dtos = new List<InvitationResponses>();
|
||||
|
||||
foreach (var inv in result)
|
||||
{
|
||||
dtos.Add(new InvitationDto(){
|
||||
dtos.Add(new InvitationResponses(){
|
||||
Id = inv.Id,
|
||||
Description = inv.Description,
|
||||
IsAdmin = inv.IsAdmin,
|
||||
@@ -67,6 +67,7 @@ public class InviteUserController : Controller
|
||||
CreatedAt = inv.DateCreated,
|
||||
EndAt = inv.EndDate,
|
||||
IsActive = inv.IsActive,
|
||||
ParticipantCount = inv.Users.Count,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,11 +88,11 @@ public class InviteUserController : Controller
|
||||
_logger.LogInformation("Getting all invitations by administrator");
|
||||
var read = await _repository.GetAllAsync();
|
||||
|
||||
List<InvitationDto> dtos = new List<InvitationDto>();
|
||||
List<InvitationResponses> dtos = new List<InvitationResponses>();
|
||||
|
||||
foreach (var inv in read)
|
||||
{
|
||||
dtos.Add(new InvitationDto(){
|
||||
dtos.Add(new InvitationResponses(){
|
||||
Id = inv.Id,
|
||||
Description = inv.Description,
|
||||
IsAdmin = inv.IsAdmin,
|
||||
@@ -100,6 +101,7 @@ public class InviteUserController : Controller
|
||||
CreatedAt = inv.DateCreated,
|
||||
EndAt = inv.EndDate,
|
||||
IsActive = inv.IsActive,
|
||||
ParticipantCount = inv.Users.Count,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,18 +122,18 @@ public class InviteUserController : Controller
|
||||
_logger.LogInformation("Getting invitations {id} by administrator");
|
||||
var read = await _repository.FindByIdAsync(id);
|
||||
|
||||
var response = new InvitationDto(){
|
||||
Id = read.Id,
|
||||
Description = read.Description,
|
||||
IsAdmin = read.IsAdmin,
|
||||
MaxParticipants = read.MaxParticipants,
|
||||
Code = read.Code,
|
||||
CreatedAt = read.DateCreated,
|
||||
EndAt = read.EndDate,
|
||||
IsActive = read.IsActive,
|
||||
var response = new InvitationResponses(){
|
||||
Id = read.Id,
|
||||
Description = read.Description,
|
||||
IsAdmin = read.IsAdmin,
|
||||
MaxParticipants = read.MaxParticipants,
|
||||
Code = read.Code,
|
||||
CreatedAt = read.DateCreated,
|
||||
EndAt = read.EndDate,
|
||||
IsActive = read.IsActive,
|
||||
ParticipantCount = read.Users.Count,
|
||||
};
|
||||
|
||||
|
||||
return Ok(response);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user