-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
190 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...DD.CQRS.Temp6.Application/PlaceholderAggregate/Queries/Todos/Fake/FakeGetAllTodosQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using MediatR; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Todos.Fake; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Todos; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using My.DDD.CQRS.Temp6.DBAccess; | ||
using My.DDD.CQRS.Temp6.Contracts.ExempleAggregate.Queries; | ||
|
||
namespace My.DDD.CQRS.Temp6.Application.PlaceholderAggregate.Queries.Todos.Fake | ||
{ | ||
public class FakeGetAllTodosQuery : IRequestHandler<FakeGetAllTodos, IEnumerable<TodoResult>> | ||
{ | ||
private readonly FakeBdContext _fakeDbContext; | ||
public FakeGetAllTodosQuery(FakeBdContext fakeDbContext) | ||
{ | ||
_fakeDbContext = fakeDbContext; | ||
} | ||
|
||
public async Task<IEnumerable<TodoResult>> Handle(FakeGetAllTodos request, CancellationToken cancellationToken) | ||
{ | ||
|
||
var result = await _fakeDbContext.GetAllTodos(); | ||
var finalResult = new List<TodoResult>(); | ||
for (int i = 0; i < result.Count(); i++) | ||
{ | ||
var res = result.ElementAt(i); | ||
finalResult.Add(new TodoResult() { Id = res.Id, UserId = res.UserId, Completed = res.Completed, Title = res.Title }); | ||
} | ||
return finalResult; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...DD.CQRS.Temp6.Application/PlaceholderAggregate/Queries/Todos/Fake/FakeGetByIdTodoQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using MediatR; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Todos; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Todos.Fake; | ||
using My.DDD.CQRS.Temp6.DBAccess; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace My.DDD.CQRS.Temp6.Application.PlaceholderAggregate.Queries.Todos.Fake | ||
{ | ||
public class FakeGetByIdTodoQuery : IRequestHandler<FakeGetByIdTodo, TodoResult?> | ||
{ | ||
private readonly FakeBdContext _fakeDbContext; | ||
public FakeGetByIdTodoQuery(FakeBdContext fakeDbContext) | ||
{ | ||
_fakeDbContext = fakeDbContext; | ||
} | ||
|
||
public async Task<TodoResult?> Handle(FakeGetByIdTodo request, CancellationToken cancellationToken) | ||
{ | ||
var res = await _fakeDbContext.GetTodo(request.TodoId); | ||
if (res == null) | ||
return null; | ||
return new TodoResult() { Id = res.Id, UserId = res.UserId, Completed = res.Completed, Title = res.Title }; | ||
} | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
My.DDD.CQRS.Temp6.Application/PlaceholderAggregate/Queries/Todos/FakeGetByIdTodoQuery.cs
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
...DD.CQRS.Temp6.Application/PlaceholderAggregate/Queries/Users/Fake/FakeGetAllUsersQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using MediatR; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Users.Fake; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Users; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using My.DDD.CQRS.Temp6.DBAccess; | ||
using My.DDD.CQRS.Temp6.Contracts.ExempleAggregate.Queries; | ||
|
||
namespace My.DDD.CQRS.Temp6.Application.PlaceholderAggregate.Queries.Users.Fake | ||
{ | ||
public class FakeGetAllUsersQuery : IRequestHandler<FakeGetAllUsers, IEnumerable<UserResult>> | ||
{ | ||
|
||
private readonly FakeBdContext _fakeDbContext; | ||
|
||
public FakeGetAllUsersQuery(FakeBdContext fakeDbContext) | ||
{ | ||
_fakeDbContext = fakeDbContext; | ||
} | ||
|
||
public async Task<IEnumerable<UserResult>> Handle(FakeGetAllUsers request, CancellationToken cancellationToken) | ||
{ | ||
var result = await _fakeDbContext.GetAllUsers(); | ||
var finalResult = new List<UserResult>(); | ||
for (int i = 0; i < result.Count(); i++) | ||
{ | ||
var element = result.ElementAt(i); | ||
finalResult.Add(new UserResult() | ||
{ | ||
Id = element.Id, | ||
Name = element.Name, | ||
Email = element.Email, | ||
Username = element.Username, | ||
Phone = element.Phone, | ||
Website = element.Website | ||
}); | ||
} | ||
return finalResult; | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...DD.CQRS.Temp6.Application/PlaceholderAggregate/Queries/Users/Fake/FakeGetByIdUserQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using MediatR; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Users; | ||
using My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Users.Fake; | ||
using My.DDD.CQRS.Temp6.DBAccess; | ||
using My.DDD.CQRS.Temp6.Domain.PlaceholderAggregate; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace My.DDD.CQRS.Temp6.Application.PlaceholderAggregate.Queries.Users.Fake | ||
{ | ||
public class FakeGetByIdUserQuery : IRequestHandler<FakeGetByIdUser, UserResult?> | ||
{ | ||
private readonly FakeBdContext _fakeDbContext; | ||
public FakeGetByIdUserQuery(FakeBdContext fakeDbContext) | ||
{ | ||
_fakeDbContext = fakeDbContext; | ||
} | ||
|
||
public async Task<UserResult?> Handle(FakeGetByIdUser request, CancellationToken cancellationToken) | ||
{ | ||
var result = await _fakeDbContext.GetUser(request.UserId); | ||
if (result == null) | ||
return null; | ||
return new UserResult() { Id = result.Id, Name = result.Name, Email = result.Email, Username = result.Username, Phone = result.Phone, Website = result.Website }; | ||
} | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
My.DDD.CQRS.Temp6.Application/PlaceholderAggregate/Queries/Users/FakeGetByIdUserQuery.cs
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
My.DDD.CQRS.Temp6.Contracts/PlaceholderAggregate/Queries/Todos/Fake/FakeGetAllTodos.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using MediatR; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Todos.Fake | ||
{ | ||
public class FakeGetAllTodos : IRequest<IEnumerable<TodoResult>> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
My.DDD.CQRS.Temp6.Contracts/PlaceholderAggregate/Queries/Users/Fake/FakeGetAllUsers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using MediatR; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace My.DDD.CQRS.Temp6.Contracts.PlaceholderAggregate.Queries.Users.Fake | ||
{ | ||
public class FakeGetAllUsers : IRequest<IEnumerable<UserResult>> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters