Fleshed out entity classes and created command to create student
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using BrightGlimmer.Service.Commands;
|
||||
using BrightGlimmer.Services.Queries;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -20,12 +21,14 @@ namespace BrightGlimmer.Api.Controllers
|
||||
public async Task<ActionResult> GetAll()
|
||||
{
|
||||
var students = await mediator.Send(new GetAllStudentsQuery());
|
||||
if (students == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return new JsonResult(students);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> Create([FromBody]CreateStudentCommand command)
|
||||
{
|
||||
var student = await mediator.Send(command);
|
||||
return new JsonResult(student);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user