Waqas Kanju Waqas Kanju - 1 year ago 69
C# Question

How to delete particular record in azure mobile Service

How to delete particular record in azure mobile Service.
For Example I have a table in azure mobile service called country having two columns

If I want to delete the record with country_id=5. How to Perform this.

//Global Variable

private MobileServiceCollection<country, country> items;
private IMobileServiceTable<country> todoTable = App.MobileService.GetTable<country>();

// Class

class country
public string id { get; set; }
public string country_name { get; set; }
public int country_id { get; set; }

Answer Source

You'll need to call DeleteAsync and pass the item you'd like to delete. In this case, the item that has your country_id.

await todoTable.DeleteAsync(country);

You can read more documentation here: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-dotnet-how-to-use-client-library/#deleting

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download