Skip to content

Commit b054d73

Browse files
authored
Merge pull request #38 from codepb/develop
Changes to API Controllers
2 parents 51e3375 + 84edd01 commit b054d73

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/DDDToolkit.API/AggregateController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ protected AggregateController(IApplicationService<T, TId> applicationService)
1919

2020
[HttpGet]
2121
[Route("{id}")]
22-
public virtual Task<T> GetById(TId id) => _readableAggregateController.GetById(id);
22+
public virtual Task<IActionResult> GetById(TId id) => _readableAggregateController.GetById(id);
2323

2424
[HttpGet]
25-
public virtual Task<IReadOnlyCollection<T>> GetAll() => _readableAggregateController.GetAll();
25+
public virtual Task<IActionResult> GetAll() => _readableAggregateController.GetAll();
2626

2727
[HttpPost]
2828
public virtual Task<IActionResult> Create([FromBody] T aggregate) => _writableAggregateController.Create(aggregate);
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using System.Collections.Generic;
22
using System.Threading.Tasks;
33
using DDDToolkit.Core.Interfaces;
4+
using Microsoft.AspNetCore.Mvc;
45

56
namespace DDDToolkit.API
67
{
78
public interface IReadableAggregateController<T, TId> where T : class, IAggregateRoot<TId>
89
{
9-
Task<IReadOnlyCollection<T>> GetAll();
10-
Task<T> GetById(TId id);
10+
Task<IActionResult> GetAll();
11+
Task<IActionResult> GetById(TId id);
1112
}
1213
}

src/DDDToolkit.API/ReadableAggregateController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ protected ReadableAggregateController(IReadableApplicationService<T, TId> applic
1919

2020
[HttpGet]
2121
[Route("{id}")]
22-
public async Task<T> GetById(TId id)
22+
public async Task<IActionResult> GetById(TId id)
2323
{
24-
return await _applicationService.GetById(id);
24+
return Ok(await _applicationService.GetById(id));
2525
}
2626

2727
[HttpGet]
28-
public async Task<IReadOnlyCollection<T>> GetAll()
28+
public async Task<IActionResult> GetAll()
2929
{
30-
return await _applicationService.GetAll();
30+
return Ok(await _applicationService.GetAll());
3131
}
3232
}
3333
}

0 commit comments

Comments
 (0)