Added some nullable regions to get rid of compiler warnings and follow best practices

This commit is contained in:
Nicolai Ort 2020-06-23 17:43:17 +02:00
parent f7c0dc66db
commit a588148dc9
7 changed files with 23 additions and 9 deletions

View File

@ -19,6 +19,7 @@ namespace ScrumTaskboard.Controllers
}
// GET: api/category
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumCategory>>> GetCategory([FromQuery]string? title, [FromQuery]int? projectid, [FromQuery] string? color)
{
@ -40,6 +41,7 @@ namespace ScrumTaskboard.Controllers
return await filtered.ToListAsync();
}
#nullable disable
// GET: api/category/1
[HttpGet("{id}")]

View File

@ -19,6 +19,7 @@ namespace ScrumTaskboard.Controllers
}
// GET: api/projects
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumProject>>> GetProject([FromQuery]string? title, [FromQuery]bool? isprivate)
{
@ -35,6 +36,7 @@ namespace ScrumTaskboard.Controllers
return await filtered.ToListAsync();
}
#nullable disable
// GET: api/projects/5
[HttpGet("{id}")]

View File

@ -16,9 +16,10 @@ namespace ScrumTaskboard.Controllers
public SprintsController(TaskContext context)
{
_context = context;
}
// GET: api/sprint
}
// GET: api/sprint
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumSprint>>> GetSprint([FromQuery]string? title, [FromQuery]int? projectid, [FromQuery]DateTime? startDate, [FromQuery]DateTime? endDate)
{
@ -43,6 +44,7 @@ namespace ScrumTaskboard.Controllers
return await filtered.ToListAsync();
}
#nullable disable
// GET: api/sprint/5
[HttpGet("{id}")]

View File

@ -18,6 +18,7 @@ namespace ScrumTaskboard.Controllers
}
// GET: api/status
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumStatus>>> GetStatus([FromQuery]string? title)
{
@ -30,6 +31,7 @@ namespace ScrumTaskboard.Controllers
return await filtered.ToListAsync();
}
#nullable enable
// GET: api/status/1
[HttpGet("{id}")]

View File

@ -16,9 +16,10 @@ namespace ScrumTaskboard.Controllers
public TasksController(TaskContext context)
{
_context = context;
}
// GET: api/tasks
}
// GET: api/tasks
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumTask>>> GetTasks([FromQuery]string? title, [FromQuery]int? userstoryid, [FromQuery]int? statusid, [FromQuery]int? assignedtoid, [FromQuery]int? projectid, [FromQuery]ScrumPrio? priority)
{
@ -51,9 +52,10 @@ namespace ScrumTaskboard.Controllers
return await filtered.ToListAsync();
}
// GET: api/tasks/5
}
#nullable disable
// GET: api/tasks/5
[HttpGet("{id}")]
public async Task<ActionResult<ScrumTask>> GetTask(int id)
{

View File

@ -18,6 +18,7 @@ namespace ScrumTaskboard.Controllers
}
// GET: api/sprint
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumUser>>> GetUser([FromQuery]string? name)
{
@ -29,6 +30,7 @@ namespace ScrumTaskboard.Controllers
return await filtered.ToListAsync();
}
#nullable disable
// GET: api/sprint/5
[HttpGet("{id}")]

View File

@ -19,6 +19,7 @@ namespace ScrumTaskboard.Controllers
}
// GET: api/userstories
#nullable enable
[HttpGet]
public async Task<ActionResult<IEnumerable<ScrumUserstory>>> GetUserstory([FromQuery]string? title, [FromQuery]int? statusid, [FromQuery]int? categoryid, [FromQuery]int? createdbyid, [FromQuery]int? projectid, [FromQuery]int? sprintid, [FromQuery]ScrumPrio? priority)
{
@ -56,6 +57,7 @@ namespace ScrumTaskboard.Controllers
return await filtered.ToListAsync();
}
#nullable disable
// GET: api/userstories/1
[HttpGet("{id}")]