Commit Graph

9 Commits

Author SHA1 Message Date
OlgunR
870b10779e Refactor Catalogs to use MediatR and CQRS pattern
Replaced direct service usage in CatalogsController with MediatR-based commands and queries for all CRUD operations. Added command/query and handler classes for Catalog operations. Updated dependency injection to register MediatR and removed ICatalogService. Improved code maintainability and testability by adopting CQRS architecture.
2026-01-19 09:00:06 +01:00
OlgunR
1fd776bc29 Prevent CatTitle changes in catalog update endpoint
The Update method now checks if CatTitle is being changed and returns a 400 Bad Request if so. It also returns 404 Not Found if the catalog does not exist before attempting an update. This ensures CatTitle remains immutable during updates.
2026-01-16 13:55:43 +01:00
OlgunR
904e6e20f0 Enforce unique catalog titles on creation
Added a uniqueness check for catalog titles in the creation flow. The service now prevents creating catalogs with duplicate titles by checking for existing entries before insertion. If a duplicate is detected, the API returns a 409 Conflict response. Updated interfaces and repository to support title-based lookups.
2026-01-16 13:42:46 +01:00
OlgunR
facc376f74 Remove Upsert functionality from Catalog API
Removed Upsert endpoint and related service/repository methods. Deleted ExecuteUpsertAsync helper. Insert now throws NotImplementedException as a placeholder. Refactored Delete method in repository; logic unchanged.
2026-01-15 16:57:33 +01:00
OlgunR
a849a88fa3 Refactor Catalog update/upsert endpoints and service logic
- Update endpoint now returns CatalogReadDto or NotFound
- Replace UpdateWithStoredProcedure with Upsert endpoint (PUT /upsert)
- Rename AddAsync to InsertAsync; UpdateAsync returns DTO or null
- Introduce UpsertAsync for combined insert/update logic
- Remove stored procedure-specific update/delete methods
- Use DTOs consistently in controller/service responses
- Repository methods now return entities instead of booleans
2026-01-14 15:29:09 +01:00
OlgunR
14e1cbc3b6 Refactor DTOs, add Blazor WASM frontend, enable CORS
- Split `CatalogDto` into `CatalogReadDto` and `CatalogWriteDto` for clear separation of read/write operations in both backend and frontend.
- Updated API controllers, services, and AutoMapper profiles to use new DTOs; ensured audit fields are set in service layer.
- Enabled CORS in the API project to support Blazor WASM frontend.
- Added new Blazor WebAssembly project (`DbFirst.BlazorWasm`) with catalog management UI, API client, Bootstrap v5.1.0 styling, and configuration-driven API base URL.
- Included `bootstrap.min.css` and its source map for frontend styling and easier debugging.
- Updated solution file to include new project and support multiple build configurations.
- Result: improved API design, clean DTO separation, and a modern interactive frontend for catalog management.
2026-01-13 10:15:01 +01:00
OlgunR
97eea94090 Update SP-based catalog update to use id route param
Refactor UpdateWithStoredProcedure to accept id from the route and set dto.Guid accordingly. In the repository, use Guid for existence checks instead of CAT_TITLE, and ensure CatTitle is not changed via the SP. Improve error handling to return NotFound when appropriate.
2026-01-12 16:39:21 +01:00
OlgunR
eabf60923d Add SP-based update/delete for Catalogs, new endpoints
Added support for updating and deleting Catalog records via SQL Server stored procedures. Introduced PUT /catalogs/sp and DELETE /catalogs/sp/{id} endpoints in CatalogsController. Extended service and repository interfaces and implementations to handle stored procedure operations. Added Microsoft.Data.SqlClient package for direct SQL execution. Repository checks for record existence before SP calls to prevent unintended behavior.
2026-01-12 12:58:41 +01:00
OlgunR
d312230803 Initial .NET 8 Web API with EF Core Db-First for Catalogs
Set up multi-project solution with DbFirst API, Application, Domain, and Infrastructure layers. Implemented database-first EF Core for the Catalog entity, including domain, DTOs, repository, service, and controller. Configured AutoMapper, DI, Swagger, and project settings. Added .gitattributes and initial configuration files.
2026-01-12 09:42:20 +01:00