/VkpApi

An API and the infrastructure of this API have been prepared for the Vakıfbank - Patika FullStack bootcamp.

Primary LanguageC#MIT LicenseMIT

VkpApi Week2 HW

An API and the infrastructure of this API have been prepared for the Vakıfbank - Patika FullStack bootcamp. This project is a digital voting system. Candidates and users can be created. Votes can be cast with user information. The results can be brought in once the voting process is completed.

Installation

After cloning the project, open the solution with Visual Studio. Run the project via IIS Express. Enter the required values ​​into the input section with Swagger.

Usage

To add migration: In VkpApi folder

Packager Manager Console > 
Add-Migration MigrationName -Project Vkp.Data

To update:

PowerShell >
dotnet ef database update --verbose --project Vkp.Data --startup-project Vkp.Api

To update database:

update-database -Project Vkp.Data

Ex Register:

{
    "TCKN": "12345678901",
    "Password": "myPassword"
}

Ex: Candidate:

{
  "name": "Candidate1",
  "party": "Party1"
}

Dependencies

  • Microsoft.AspNetCore.OpenApi
  • Microsoft.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore.Design
  • Microsoft.EntityFrameworkCore.SqlServer
  • Microsoft.EntityFrameworkCore.Tools
  • Swashbuckle.AspNetCore

Demo

Fake Service - Dependency Injection

  • This service creates fake candidates. It was written as an example instead of a user login service.

    FakeCandidateService-DependencyInjection

Extension

  • This extension is used to convert from the main model to a dto model that contains only the necessary fields.

    ToDtoExtension

SwaggerImplementation

SwaggerImplementation

Global Logging Middleware Output

  • This middleware logs http requests.

    GlobalLoggingMiddleware

Global Exception Middleware

  • This middleware API logs in case of exceptions (status 500 code).

    GlobalExceptionMiddleware