This commit is contained in:
2020-06-08 23:59:40 +00:00
parent 937e9c5907
commit f22f2a9cda
3 changed files with 10 additions and 6 deletions

View File

@@ -45,9 +45,14 @@ namespace rockfishCore.Controllers
[HttpPost("reply/{account}/{id}")] [HttpPost("reply/{account}/{id}")]
public JsonResult Reply([FromRoute] string account, [FromRoute] uint id, [FromBody] dtoReplyMessageItem m) public ActionResult Reply([FromRoute] string account, [FromRoute] uint id, [FromBody] dtoReplyMessageItem m)
{ {
if (string.IsNullOrWhiteSpace(m.composition)) if (!ModelState.IsValid)
{
return BadRequest();
}
if (m==null || string.IsNullOrWhiteSpace(m.composition))
{ {
return Json(new { msg = "MailController:Reply->There is no reply text", error = 1 }); return Json(new { msg = "MailController:Reply->There is no reply text", error = 1 });
} }

View File

@@ -42,7 +42,7 @@ namespace rockfishCore
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddControllers(); services.AddControllers().AddNewtonsoftJson();
services.AddDbContext<rockfishContext>(options => services.AddDbContext<rockfishContext>(options =>
{ {
options.UseSqlite(Configuration.GetConnectionString("rfdb")).EnableSensitiveDataLogging(false); options.UseSqlite(Configuration.GetConnectionString("rfdb")).EnableSensitiveDataLogging(false);
@@ -111,9 +111,8 @@ namespace rockfishCore
app.UseRouting(); app.UseRouting();
app.UseAuthorization(); app.UseAuthorization();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers(); endpoints.MapControllers();
}); });

View File

@@ -14,7 +14,7 @@
<PackageReference Include="jose-jwt" Version="2.5.0" /> <PackageReference Include="jose-jwt" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.4" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.4" />
<PackageReference Include="mailkit" Version="2.7.0" /> <PackageReference Include="mailkit" Version="2.7.0" />
<!-- <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" /> --> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" />
</ItemGroup> </ItemGroup>
</Project> </Project>