public ActionResult <IEnumerable <SeenAnimal> > Get()
        {
            var db = new SafariVacationApiEndorsedContext();

            return(db.SeenAnimals);

            // In Postman Use --> https://localhost:5001/api/animal
        }
        public ActionResult <SeenAnimal> Post([FromBody] string Species)
        {
            var animal = new SeenAnimal
            {
                Species = Species,
            };

            var db = new SafariVacationApiEndorsedContext();

            db.SeenAnimals.Add(animal);
            db.SaveChanges();
            return(animal);

            // In Postman Use --> https://localhost:5001/api/animal/ --> Add Animal Name in Quotes in Body
        }
 public AnimalController()
 {
     this.db = new SafariVacationApiEndorsedContext();
 }
Example #4
0
 public SearchController()
 {
     this.db = new SafariVacationApiEndorsedContext();
 }