* Added maintaining Products
* Extended DataModels * Extended API
This commit is contained in:
31
FaKrosnoApi/Controllers/ProductController.cs
Normal file
31
FaKrosnoApi/Controllers/ProductController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using FaKrosnoEfDataModel.Dtos;
|
||||
using FaKrosnoEfDataModel.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace FaKrosnoApi.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ProductController(IProductService service) : Controller
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<ProductDto>>> GetAll()
|
||||
{
|
||||
IEnumerable<ProductDto?> products = await service.GetEntities();
|
||||
return Ok(products);
|
||||
}
|
||||
|
||||
[HttpGet("by-index")]
|
||||
public async Task<ActionResult<IEnumerable<ProductDto>>> GetByIndex([FromQuery] string indexName)
|
||||
{
|
||||
IEnumerable<ProductDto?> products = await service.GetEntitiesToFix(indexName);
|
||||
return Ok(products);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public async Task<ActionResult> Update([FromBody] ProductDto product)
|
||||
{
|
||||
await service.UpdateEntity(product);
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,7 @@ builder.Services.AddScoped<IUserService, UserService>();
|
||||
builder.Services.AddScoped<IRoleService, RoleService>();
|
||||
builder.Services.AddScoped<IFunctionService, FunctionService>();
|
||||
builder.Services.AddScoped<IUserRoleService, UserRoleService>();
|
||||
builder.Services.AddScoped<IProductService, ProductService>();
|
||||
|
||||
builder.Services.AddHostedService<TimedHostedService>();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"FaKrosnoConnection": "Server=192.168.0.7;Database=fakrosnotest;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
||||
"SytelineSaAppConnection": "Server=192.168.0.7;Database=SL_PRODTEST_SA_APP;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
||||
"FaKrosnoConnection": "Server=192.168.0.7;Database=fakrosno;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
||||
"SytelineSaAppConnection": "Server=192.168.0.7;Database=SL_PROD_SA_APP;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true",
|
||||
"OrdersManagementConnection": "Server=192.168.0.7;Database=OrdersManagement;User Id=sa;Password=Tetum#2021!;TrustServerCertificate=true"
|
||||
},
|
||||
"Logging": {
|
||||
|
||||
Reference in New Issue
Block a user