Continued to work on the update student handler
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JsonNet.PrivateSettersContractResolvers.Source" Version="0.1.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MediatR" Version="6.0.0" />
|
||||
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" />
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace BrightGlimmer.Api.Controllers
|
||||
[HttpPut]
|
||||
public async Task<ActionResult> Update([FromBody]UpdateStudentCommand command)
|
||||
{
|
||||
|
||||
var student = await mediator.Send(command);
|
||||
return new JsonResult(student);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,12 @@ namespace BrightGlimmer.Api
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
||||
services.AddMvc()
|
||||
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.SerializerSettings.ContractResolver = new PrivateSetterContractResolver()
|
||||
});
|
||||
|
||||
services.AddMediatR();
|
||||
services.AddMediatR(typeof(Cqrs.Cqrs).Assembly); // Registers handlers in services project
|
||||
|
||||
Reference in New Issue
Block a user