Skip to content

BAPotts/AnimalShelter.Solution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

🐾 Animal Shelter

C#/.Net SQL API Bulding Exercise for Epicodus, 08/21/2020

✏️ By Beverly Potts

💎 Description

Demonstrates API building process by creating two databases, one for dogs and one for cats, seeding the data and providing routes To create, read, update and delete entries.

🐱 Cat Http Request

GET /api/cats
POST /api/cats
GET /api/cats/{id}
PUT /api/cats/{id}
DELETE /api/cats/{id}
GET /api/cats/random (Return random cat object)

🐱 Pagination

GET /api/cats/page/?pageNumber=1&pageSize=2

🐱 Cat Path Parameters

Parameter Type Default Required Description
name string none false Return matches by name.
color string none false Return matches by color.
breed string none false Return matches by breed.
age int none false Return matches by age.
gender string none false Return matches by gender.

🎯 Example Query

http://localhost:5000/api/cats/?gender=male&color=black

🎯 Sample JSON Response

 {
        "catId": 2,
        "name": "Jasper",
        "color": "Black",
        "breed": "Domestic Mediumhair",
        "age": 3,
        "gender": "Male"
    },
    {
        "catId": 10,
        "name": "Jiji",
        "color": "Black",
        "breed": "Domestic Shorthair",
        "age": 5,
        "gender": "Male"
    }

🐶 Dog Http Request

GET /api/dogs
POST /api/dogs
GET /api/dogs/{id}
PUT /api/dogs/{id}
DELETE /api/dogs/{id}
GET /ap/dogs/random (return random dog object)

🐶 Pagination

GET /api/dogs/page/?pageNumber=1&pageSize=2

🐶 Dog Path Parameters

Parameter Type Default Required Description
name string none false Return matches by name.
color string none false Return matches by color.
breed string none false Return matches by breed.
age int none false Return matches by age.
gender string none false Return matches by gender.

🎯 Example Query

http://localhost:5000/api/dogs/?age=6

🎯 Sample JSON Response

{
  "dogId": 6,
  "name": "Fido",
  "color": "Tawny",
  "breed": "Wolfhound",
  "age": 6,
  "gender": "Female"
}

📋 Setup/Installation Requirements

  1. Follow this link to the project repository on GitHub.
  2. Click on the "Clone or download" button to copy the project link.
  3. If you are comfortable with the command line, you can copy the project link and clone it through your command line with the command git clone. Otherwise, I recommend choosing "Download ZIP".
  4. Once the ZIP file has finished downloading, you can right click on the file to view the zip folder in your downloads.
  5. Right click on the project ZIP folder that you have just downloaded and choose the option "Copy To...", then choose the location where you would like to save this folder.
  6. Navigate to the final location where you have chosen to save the project folder.
  7. To view the code itself, right click, choose "open with..." and open using a text editor such as VS Code or Atom, etc.
  8. Open the terminal inside of your text editor.
  9. From inside of the AnimalShelter directory, type the command dotnet restore into your terminal and hit enter. You should see object files appear. They should be greyed out.

📇 Database Population

To populate a database:

  1. Delete the migrations folder.
  2. Navigate to AnimalShelter folder.
  3. Run dotnet ef migrations add Initial in the terminal.
  4. Then run dotnet ef database update.

🐛 Known Bugs

There are no known bugs at this time.

🙋 Support and Contact Details

Feedback is greatly appreciated! Contact BAPotts on GitHub with any questions or comments.

💻 Technologies Used

  • C#
  • EntityFrameworkCore
  • .NET-Core 2.2
  • Visual Studio Code
  • Git Version Control
  • GitHub
  • Sql Workbench 8.0

📜 License

This project is licensed under the MIT license.

Copyright (c) 2020 {Beverly Potts}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages