public ActionResult <IEnumerable <Park> > Post([FromBody] Park park) { _db.Parks.Add(park); _db.SaveChanges(); State state = _db.States.Find(park.StateId); state.NumberParks++; _db.SaveChanges(); return(_db.Parks.Include(entry => entry.State).ToList()); }
public void Post([FromBody] State state) { _db.States.Add(state); state.NumberParks = 0; _db.SaveChanges(); }