File tree Expand file tree Collapse file tree 4 files changed +33
-5
lines changed
TaleEngine.Bussiness/Queries Expand file tree Collapse file tree 4 files changed +33
-5
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public EditionDaysDto EditionDaysQuery(int editionId)
3636 }
3737
3838 public List < EditionDto > EditionsQuery ( int eventId ) {
39- if ( eventId == 0 ) throw new ArgumentNullException ( ) ;
39+ if ( eventId == 0 ) return null ;
4040
4141 var editionsOfEvent = _service . GetEditions ( eventId ) ;
4242
@@ -53,7 +53,7 @@ public List<EditionDto> EditionsQuery(int eventId) {
5353
5454 public int FutureOrCurrentEditionQuery ( int ofEvent )
5555 {
56- if ( ofEvent == 0 ) throw new ArgumentNullException ( ) ;
56+ if ( ofEvent == 0 ) return 0 ;
5757
5858 var editionsOfEvent = _service . GetEditions ( ofEvent ) ;
5959
Original file line number Diff line number Diff line change @@ -60,6 +60,12 @@ public IActionResult GetAllRoles()
6060 public IActionResult GetRole ( int roleId )
6161 {
6262 var result = query . GetRoleQuery ( roleId ) ;
63+
64+ if ( result == null )
65+ {
66+ return NoContent ( ) ;
67+ }
68+
6369 return Ok ( result ) ;
6470 }
6571
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ public IActionResult GetAllUsers()
2222 {
2323 var result = _queries . AllUsersQuery ( ) ;
2424
25+ if ( result == null || result . Count == 0 )
26+ {
27+ return NoContent ( ) ;
28+ }
29+
2530 return Ok ( result ) ;
2631 }
2732
Original file line number Diff line number Diff line change 1- using Microsoft . AspNetCore . Mvc ;
1+ using System ;
2+ using Microsoft . AspNetCore . Mvc ;
23using TaleEngine . CQRS . Contracts ;
34
45namespace TaleEngine . API . Controllers . V1
@@ -11,14 +12,19 @@ public class EventController : Controller
1112
1213 public EventController ( IEventQueries queries )
1314 {
14- _queries = queries ;
15+ _queries = queries ?? throw new ArgumentNullException ( nameof ( queries ) ) ;
1516 }
1617
1718 [ HttpGet ( "[action]" ) ]
1819 public IActionResult GetEvents ( )
1920 {
2021 var result = _queries . EventsNoFilterQuery ( ) ;
2122
23+ if ( result == null || result . Count == 0 )
24+ {
25+ return NoContent ( ) ;
26+ }
27+
2228 return Ok ( result ) ;
2329 }
2430
@@ -27,13 +33,24 @@ public IActionResult GetEvent(int eventId)
2733 {
2834 var result = _queries . GetEvent ( eventId ) ;
2935
36+ if ( result == null )
37+ {
38+ return NotFound ( ) ;
39+ }
40+
3041 return Ok ( result ) ;
3142 }
3243
3344 [ HttpGet ( "[action]" ) ]
34- public IActionResult GetCurrentEditionInEvent ( int eventId ) {
45+ public IActionResult GetCurrentEditionInEvent ( int eventId )
46+ {
3547 var result = _queries . GetCurrentEdition ( eventId ) ;
3648
49+ if ( result == null )
50+ {
51+ return NotFound ( ) ;
52+ }
53+
3754 return Ok ( result ) ;
3855 }
3956 }
You can’t perform that action at this time.
0 commit comments