public Campground UpdateCampground(Campground campground) { using (var campgroundDbContext = new CampgroundDbContext()) { campgroundDbContext.Campgrounds.Update(campground); campgroundDbContext.SaveChanges(); return(campground); } }
public void DeleteCampground(int id) { using (var campgroundDbContext = new CampgroundDbContext()) { var deletedCampground = GetCampgroundById(id); campgroundDbContext.Remove(deletedCampground); campgroundDbContext.SaveChanges(); } }