Closed Evan-Gilbert-1212 closed 4 years ago
API: https://github.com/Evan-Gilbert-1212/TamagotchiAPI (Deployed to Heroku at: https://tamagotchi-api.herokuapp.com/) (Alive Pet "GET" page: https://tamagotchi-api.herokuapp.com/api/Pet/Alive)
Console App: https://github.com/Evan-Gilbert-1212/TamagotchiApp (Interacting with API deployed to Heroku)
The Rise of the Tamagotchi
To start your journey you will be creating an API that allows a user to create and care for a virtual pet, reminiscent of a Tamagachi. The basic functionality will walk you through the 4 basic parts of a web api, create, read, update and delete. For explorer mode, keep it simple and they add features.
Objectives
Requirements
sdg-api
template using the commanddotnet new -i SDG.templates.Web.API
Explorer Mode
Create and new
sdg-api
that has the following featuresa database with 1 table, called
Pets
.Pet
with the following columns:Your API should have the following endpoints
GET /api/pets
, this should return all pets in your database.GET /api/pets/{id}
, This should return the pet with the corresponding Id.POST /api/pets
, This should create a new pet. The body of the request should contain the name of the pet.PUT /api/pets/{id}/play
, This should find the pet by id, and add 5 to its happiness level and add 3 to its hungry levelPUT /api/pets/{id}/feed
, This should find the pet by id, and remove 5 from its hungry level and add 3 to its happiness level.PUT /api/pets/{id}/scold
, This should find the pet by id, and remove 5 from its happiness levelDELETE /api/pets/{id}
, this should delete a pet from the database by IdAdventure Mode
Add the following features to your API
IsDead
(bool). Whenever you call a PUT to update a pet, give your pet a 10% chance of Dying.LastInteractedWithDate
(DateTime), that gets updated every time a pet is queried from the database on PUT or a GET. If theLastInteractedWithDate
is ever over 3 days, the pet should die from neglect.Create a console app that interacts with your API that:
Epic mode
Resources