combined get and post into one method