删除记录xamarin

时间:2017-11-20 23:57:40

标签: c# android linq xamarin

我试图让用户从数据库中删除一条记录,但它不会让我这样做。任何人都可以建议这样做吗?

List<Booking> item = new List<Booking>();
item = await BookingsTable
            .Where(todoItem => todoItem.Email == "email" && todoItem.Slot == 9)
            .ToListAsync();

if (item != null)
{
    //delete the record here
}

1 个答案:

答案 0 :(得分:0)

List<Booking> item = new List<Booking>();
item = await BookingsTable
            .Where(todoItem => todoItem.Email == "email" && todoItem.Slot == 9)
            .ToListAsync();

if (item != null)
{
    await BookingsTable.DeleteAsync(item);
}

满足您的需求 - https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-dotnet-how-to-use-client-library#deleting