[英]Azure Mobile Services - Updating an Entry in the Database
我正在嘗試更新名為“請求”的表中的條目。 該表包含諸如“名稱”和“已接受”的列。 我只想更新“ Accepted”字段(包含一個布爾值),使其變為true。 我只希望在滿足某些條件的情況下對其進行更新,即數據庫中的“名稱”與文本框中的名稱相同。
private IMobileServiceTable<Request> requestTable= App.appClient.GetTable<Request>();
private MobileServiceCollection<Request, Request> requests;
requests= await requestTable
.Where(c => c.Name == txtName.Text)
.ToCollectionAsync();
//what should I put here to update Accepted to true?
await requestTable.UpdateAsync(requests);
如何修改此代碼,以便將“已接受”更新為true,但僅適用於名稱匹配的行?
任何幫助,將不勝感激,謝謝。
您可以這樣做。
codes.ForEach(p => p.Request = true);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.