Skip to content

A Simple API for Currency rates management and calculation

Notifications You must be signed in to change notification settings

gberket/currency-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 

Repository files navigation

Currencies API

An API that manages Currencies and Currency rates written in .Net Core

It is a Demo CRUD application.

How to run

  1. Download or clone the project.

  2. Database setup: You can leave the settings as is and use the in memory db or you can change the appsettings.json not to use inMemoryDB and use your Sql Server as below:

"AppSettings": {
    "UseInMemoryDatabase":"False",
...
  },
...
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=YOUR_DB_NAME;User Id=YOUR_DB_USER;Password=YOUR_PASSWORD;"
  }

If you chose to use Sql Server, in a terminal, navigate in the project's folder and run the command:

dotnet ef database update
  1. In a terminal, navigate in the currency-api folder and run the command
dotnet run
  1. Navigate to the swagger endpoint to browse all the available endpoints and actions.

  2. Go to the publicly available (unprotected) Auth login and Execute a POST call with the admin account (has all the roles and has unlimited access):

{
  "userName": "admin",
  "password": "admin123",
}

Or the simple user account (Can access -read- only the currency rates, login or reset password):

{
  "userName": "user",
  "password": "user123",
}

You will receive a UserDTO object as an answer from the API. The Token property will be populated with the Api JWT access token.

  1. On the Swagger UI top-right click on the "Authorize" button and enter:
Bearer _the_token_you_received_from _the_login_call_

And click Authorize.

Now you can browse in the API from the swagger UI.

Features

  • Code First Development with Entity Framework
  • Thee Layer Achitecture with Controllers Layer, Business Logic Layer(Services), Data Layer (Repositories)
  • Dependency Injection
  • Repositories and Unit of work Patterns
  • Abstract repository and central save logic
  • Custom extensions methods
  • Mapping to DTOs (viewModels) with AutoMapper
  • Jwt Authentication
  • Role based authorization
  • Soft Deletion with query filters
  • Auditing details on all entities by using a base model

License

Feel free to use this code in your projects

About

A Simple API for Currency rates management and calculation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages