public void Post([FromBody] Animal animal) { _db.Animals.Add(animal); _db.SaveChanges(); }
public void Post([FromBody] Animal animal) //[Frombody] needed to put the details of a new animal in the body of a POST API call. { _db.Animals.Add(animal); _db.SaveChanges(); }
public void Post([FromBody] Animal animal) //Getting the animal from the body of the HTTP request { _db.Animals.Add(animal); _db.SaveChanges(); }
public void Put(int id, [FromBody] Animal animal) { animal.AnimalId = id; _db.Entry(animal).State = EntityState.Modified; _db.SaveChanges(); }