Book Image

Xamarin Mobile Application Development for Android, Second Edition

Book Image

Xamarin Mobile Application Development for Android, Second Edition

Overview of this book

Table of Contents (18 chapters)
Xamarin Mobile Application Development for Android Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding the save and delete actions in POIService


In Chapter 4, Adding a ListView, we created the specialized POIService class that handles the logic for downloading data using the async and await keywords in conjunction with HttpClient. For now, the POIService class has only one method GetPoisListAsync(), that deals with fetching the list of records from the REST web service. Let's extend its functionality to create a new or update and delete a POI. Let's first start with creating a POI.

Consuming the web service to create or update a POI

At this point, we have already deployed the web service provided in the book code bundle, and POIApp is already consuming the same web services to fetch the list of POIs. In this section, we will use the same web service to create a new or update an existing POI.

The following API specification is used to create a new or update an existing POI:

Request Method: POST
Resource Endpoint: /com.packet.poiapp/api/poi/pois
Content-type: application/json
Request Body...