I am new to the windows azure world, I am trying to send an item to the SQL DB and track it by a specific "usrID" to then hopefully update it.
Right now I also have a class:
public class Item
{
public int Id { get; set; }
[JsonProperty(PropertyName = "url")]
public string url { get; set; }
[JsonProperty(PropertyName = "usrID")]
public string usrID { get; set; }
[JsonProperty(PropertyName = "complete")]
public bool Complete { get; set; }
}
To save/insert Data I use:
private void ButtonSave_Click(object sender, RoutedEventArgs e)
{
var todoItem = new Item { usrID = "helloworld", url = Input.Text };
InsertTodoItem(todoItem);
}
When I am trying to update, I am using this:
private void btns_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
Item item;
item = new Item();
item.url = "hello";
UpdateItem(item);
}
* Trying to do this will not work. It also wont let me do Item item = new Item();
The update function is:
private async void UpdateItem(Item item)
{
await todoTable.UpdateAsync(item);
items.Remove(item);
}
So, what I am trying to do is, the last/only item inserted by "usrID" to get that data and show it. But also if something changes, I want that one specific insert from "usrID" that includes url to be updated (opposed from deleted entirely).
Any help would be great!
List<Item> items = await App.MobileService.GetTable<Item>().OrderBy(item => item.usrID).ToListAsync();
int mas = items.Count();
await Table.UpdateAsync(new Item {Id = mas, usrID = "helloworld", url = "itworked" });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.