Authors: Ariel R. Pedraza, Luay Younus, Dustin Mundy
Version: 1.0.0
An API created from scratch used to request and modify a database of blademaster weapons for the game Monster Hunter Generations with CRUD routes.
The following are required to run the program locally.
- Visual Studio 2017 Community with .NET Core 2.0 SDK
- GitBash / Terminal or GitHub Extension for Visual Studio
- Clone the repository to your local machine.
- Cd into the application directory where the
MonsterHunterAPI.sln
exist. - Open the application using
Open/Start MonsterHunterAPI.sln
.
- Once the App is opened, Right click on the application name from the
Solution Explorer Window
and selectAdd
->New Item
-> findASP.NET Configuration File
and open add it to the project.
- Inside this file, change the Connection String to the following to connect to database
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=TaskDB;Trusted_Connection=True;MultipleActiveResultSets=true"
}
- Click
Tools
->NuGet Package Manager
->Package Manager Console
then run the following commands in the console.
- Install-Package Microsoft.EntityFrameworkCore.Tools
- Add-Migration Initial
- Update-Database
Getting all Blades from the Database
GET: /api/blade/
Getting a single Blade by ID. This endpoint will return a list of materials in the returned Blade object
GET: /api/blade/:bladeId
Filtering list of blades by Weapon Or/And Element Or/And Rarity
GET: /api/blade/:weaponClass/:element/:rarity
Post/Create a new Weapon/Blade on the Database
POST: api/blade
Update a blade/weapon
PUT: api/blade/:id
Delete a blade from the database
DELETE: api/blade/:id
[
{
"id": 1,
"parent": null,
"hasChild": true,
"weaponClass": "Long Sword",
"name": "Iron Katana 1",
"description": "A Long Sword forged with Eastern methods. Durable and resilient, but requires regular upkeep.",
"rawDamage": 70,
"elementType": null,
"elementDamage": 0,
"sharpness": "Yellow",
"rarity": 1,
"affinity": 0,
"slots": 0,
"defense": 0,
"imgUrl": null,
"materials": null
},
{
"id": 2,
"parent": {
"id": 1,
"parent": null,
"hasChild": true,
"weaponClass": "Long Sword",
"name": "Iron Katana 1",
"description": "A Long Sword forged with Eastern methods. Durable and resilient, but requires regular upkeep.",
"rawDamage": 70,
"elementType": null,
"elementDamage": 0,
"sharpness": "Yellow",
"rarity": 1,
"affinity": 0,
"slots": 0,
"defense": 0,
"imgUrl": null,
"materials": null
}
}
]
Getting all materials from Database
GET: /api/material
Getting one material by ID
GET: /api/material/:id
Posting a material with a list of locations
POST: /api/material
[
{
"id": 1,
"name": "Iron Ore",
"rarity": 4,
"description": null,
"quantity": 0,
},
{
"id": 2,
"name": "Earth Crystal",
"rarity": 4,
"description": null,
"quantity": 0
},
{
"id": 3,
"name": "Disc Stone",
"rarity": 4,
"description": null,
"quantity": 0
},
{
"id": 4,
"name": "Machalite Ore",
"rarity": 4,
"description": null,
"quantity": 0
}
]
Getting All Locations from Database
GET: /api/location
Getting one Location by ID
GET: /api/:locationId
Creating a new Location
A location object requires properties of Name
and Area
POST: api/Location
Update an existing Location
PUT: api/Location/:id
Delete a location
DELETE: api/Location/:id
[
{
"id": 1,
"name": "The Forrest",
"area": 5,
"dropRate": 13,
"action": "mining"
},
{
"id": 2,
"name": "The Hill",
"area": 12,
"dropRate": 4,
"action": "climbing"
}
]
- Entity Framework Core
- ASP.NET Core
- Swashbuckle
- Xunit
C# ASP.NET Core MVC Application