/// <summary> /// Read item from server /// </summary> /// <returns></returns> public async Task ReadItem() { CoreItemJson = (await ItemService.ReadJsonAsync(new List <Guid>() { _itemId }))?.FirstOrDefault(); VMVisible.SetVisibility(CoreItemJson.JSON); }
/// <summary> /// Create items from json /// </summary> /// <returns></returns> public async Task CreateItem() { Working = true; try { var coreItemJsons = await ItemService.CreateJsonAsync(ItemJson); CoreItemJson = coreItemJsons.First(); VMVisible.SetVisibility(CoreItemJson.JSON); } finally { Working = false; } }
/// <summary> /// Update multiple items on server /// </summary> /// <returns></returns> public async Task UpdateItem() { Working = true; try { var item = JsonConvert.DeserializeObject <Item>(_itemJson); var coreItemJson = new CoreItemJson() { Id = ItemId, IncludeChildren = true, JSON = ItemJson }; await ItemService.UpdateJsonAsync(new List <CoreItemJson>() { coreItemJson }); VMVisible.SetVisibility(coreItemJson.JSON); } finally { Working = false; } }