Some other func
This commit is contained in:
@@ -9,9 +9,15 @@ namespace WorkFlowCheck.API.Controllers
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult<ResponseDTO> Get()
|
||||
public async Task<ApiResponseDTO<UserDTO>> Get()
|
||||
{
|
||||
return new ResponseDTO { Message = "Success" };
|
||||
var userDTO = new UserDTO() { Id = 1, Email = "email", Name = "Name" };
|
||||
var retVal = new ApiResponseDTO<UserDTO>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Data = userDTO
|
||||
};
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using WorkFlowCheck.API;
|
||||
using WorkFlowCheck.DL;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -45,12 +46,13 @@ builder.Services.AddSwaggerGen(c =>
|
||||
});
|
||||
});
|
||||
|
||||
// Szolgáltatások hozzáadása
|
||||
builder.Services.AddControllers().AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
||||
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
||||
}); ;
|
||||
builder.Services.AddControllers()
|
||||
.AddNewtonsoftJson(options =>
|
||||
{
|
||||
// Itt konfigurálhatod az egyedi beállításokat
|
||||
options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
|
||||
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
// Swagger middleware
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user