Exemplo n.º 1
0
        public SeenAnimal Post([FromBody] SeenAnimal animal)
        {
            var dbConnection = new SafariAdventureContext();

            dbConnection.SeenAnimal.Add(animal);
            dbConnection.SaveChanges();
            return(animal);
        }
Exemplo n.º 2
0
        public SeenAnimal Post([FromBody] SeenAnimal species)
        {
            this.db.SeenAnimals.Add(species);

            this.db.SaveChanges();

            return(species);
        }
Exemplo n.º 3
0
        public ActionResult <SeenAnimal> Post([FromBody] string species)
        {
            var animal = new SeenAnimal
            {
                Species            = species,
                LocationOfLastSeen = "Africa",
            };

            this.db.SeenAnimals.Add(animal);

            this.db.SaveChanges();

            return(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
        }