DotNet Projects

H8_MovieStore

In this solution, Movie Store API was created and the following technologies were used.

  1. Used ViewModel and Dto using CQRS principle. Objects were transformed into each other with the Automapper library.
  2. All validations were created with the FluentValidation library.
  3. Exception and Logging infrastructure is written with custom Middleware.
  4. Dependency within the project is minimized. Dependencies were managed from a single point by using DI Container and Dependency Injection at necessary points.
  5. A basic level Authentication and Authorization structure was implemented in the project with JwtBearer. Endpoints are authorized only by the Customer Endpoint.
  6. The tests of the project were written with Unit Test.

CRUD Operations with Postman

This section shows CRUD operations for any data in the API (movies, directors, etc.) using Postman.

For Postman Documentation: Authentication, Authorization and CRUD Operations

1. First of all, in order to access any data, a customer record must first be created.

  • API Customer Endpoint: POST /customers
  • Sample Json Format that should be included in the body of the request to be sent:
{
  "name": "Enes",
  "surName": "Orhan",
  "email": "enesorhan@hotmail.com",
  "password": "12345"
}

2. AccessToken is created with the created customer record.

  • Endpoint to use to create AccessToken: POST /customers/connect/token
  • Sample Json Format to be sent to provide Authentication with Endpoint:
{
  "email": "enesorhan@hotmail.com",
  "password": "12345"
}
  • Sample Json format in the body as response:
{
    "accesToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2OTU5NDQ2NjgsImV4cCI6MTY5NTk0NTU2OCwiaXNzIjoid3d3LnRlc3QuY29tIiwiYXVkIjoid3d3LnRlc3QuY29tIn0.vBZoAtujJmC8qEpQJEDlg7b14DZJJIex6jlZhL5iCD4",
    "expiration": "2023-09-29T02:59:28.4987901+03:00",
    "refreshToken": "0cea5f70-a04a-48df-9b35-663eb36af511"
}
  1. The AccessToken obtained in the Response Body is added as a Bearer Token in the Authorization section of the request to be used in CRUD operations. Authorization to call GET request on Actors:

image

  1. Endpoints of CRUD operations of Actors are as follows.
  • To list all actors : GET /actors
  • To add a new actor : POST /actors
  • To update a actor : PUT /actors/{id}
  • To delete a actor : DELETE /actors/{id}

H1_RestfulApi

This project provides a RESTful API that can be used to perform basic operations such as adding, updating, listing and deleting products.
It also includes the ability to list and sort products.
Below are the API endpoints and screenshot.

API Endpoints

  • To list all books: GET /api/books/getbooks
  • To filter and sort books by name: GET /api/Books/GetBookName?name={name}
  • To get a specific book by ID: GET /api/books/getbyid/{id}
  • To add a new book: POST /api/books/createbook
  • To update a book: PUT /api/books/updatebook/{id}
  • To delete a book: DELETE /api/books/deletebook?id={id}

image

H2_DIandMiddleware

In this solution, custom middleware and Dependency Injection were created for the solution in H1_RestfulApi Below are the API endpoints and screenshot of the output in the Console for Dependency Injection and the incoming Request.
Additionally, Extension Method was used for Singleton.

API Endpoints

  • To list all books: GET /api/books/getbooks
  • To filter and sort books by name: GET /api/Books/GetBookName?name={name}
  • To get a specific book by ID: GET /api/books/getbyid/{id}
  • To add a new book: POST /api/books/createbook
  • To update a book: PUT /api/books/updatebook/{id}
  • To delete a book: DELETE /api/books/deletebook?id={id}

image

H3_ModelUsing/BookStore

In this solution, it is aimed to make the code cleaner by using ViewModel and Model concepts.
This project provides a RESTful API that can be used to perform basic operations such as adding, updating, listing and deleting books (CRUD).
Below are the API endpoints and screenshot.

API Endpoints

  • To list all books: GET /api/books/getbooks
  • To get a specific book by ID: GET /api/books/getbyid/{id}
  • To add a new book: POST /api/books/createbook
  • To update a book: PUT /api/books/updatebook/{id}
  • To delete a book: DELETE /api/books/deletebook/{id}

image

H4_FluentValidation

In this solution, Fluent Validation has been applied to the Models in H3_ModelUsing/BookStore

API Endpoint

  • To get a specific book by ID: GET /books/{id}

In the screenshot below, according to the request created with the above API Endpoint by giving the wrong ID in the GetBooks process with the Specific ID; There is a Status Code returned in the response and a Validation Failed error returned in the response body.

image

H5_GenreController

In this solution, entity, controllers, various validation and mapper operations belonging to the Book Genre for the project in H4_FluentValidation were created.
Below are the API endpoints and screenshot.

API Endpoints

  • To list all genres: GET /genres
  • To get a specific genre by ID: GET /genres/{id}
  • To add a new genre: POST /genres
  • To update a genre: PUT /genres/{id}
  • To delete a genre: DELETE /genres/{id}

image

H6_AuthorController

In this solution, entity, controllers, various validation and mapper operations belonging to the Book Author for the project in H5_GenreController were created.
Below are the API endpoints and screenshot.

API Endpoints

  • To list all authors: GET /authors
  • To get a specific author by ID: GET /authors/{id}
  • To add a new author: POST /authors
  • To update a author: PUT /authors/{id}
  • To delete a author: DELETE /authors/{id}

image

H7_UnitTest

In this solution, Unit Tests were written for the BookStore project in H6_AuthorController.

Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually scrutinized for proper operation.

The file structure created according to commands and requests has been preserved, and a Unit Test has been written for each method used.
.NET Core Test Explorer Extension was used to view and test the tests together. The file structure and extension content are below.

image