Exemplo n.º 1
0
        public IEnumerable <SeenAnimal> GET(string location)
        {
            var dbConnections = new SafariAdventureContext();
            var Animals       = dbConnections.SeenAnimal.Where(a => a.Location == location).ToList();

            return(Animals);
        }
Exemplo n.º 2
0
        public IEnumerable <SeenAnimal> GET()
        {
            var dbConnections = new SafariAdventureContext();
            var Animals       = dbConnections.SeenAnimal;

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

            dbConnection.SeenAnimal.Add(animal);
            dbConnection.SaveChanges();
            return(animal);
        }
Exemplo n.º 4
0
        public ActionResult <SeenAnimals> Delete([FromBody] string species)
        {
            var animal = new SeenAnimals {
                Species = species,
            };
            var db = new SafariAdventureContext();

            db.SeenAnimals.Add(animal);

            db.SaveChanges();

            return(animal);
        }
Exemplo n.º 5
0
        public ActionResult <SeenAnimals> Put([FromBody] string species)
        {
            var animal = new SeenAnimals {
                Species            = species,
                LocationOfLastSeen = "outside",
            };
            var db = new SafariAdventureContext();

            db.SeenAnimals.Add(animal);

            db.SaveChanges();

            return(animal);
        }
Exemplo n.º 6
0
        public ActionResult <IEnumerable <SeenAnimals> > Get()
        {
            var db = new SafariAdventureContext();

            return(db.SeenAnimals);
        }
Exemplo n.º 7
0
 public AnimalsController()
 {
     this.db = new SafariAdventureContext();
 }
Exemplo n.º 8
0
 public SearchController()
 {
     this.db = new SafariAdventureContext();
 }