public MonkeyViewModel(Monkey monkey)
 {
     Monkey = monkey;
 }
 public async Task SaveMonkeyAsync(Monkey item)
 {
     if (item.Id == null)
     {
         await this.monkeyTable.InsertAsync(item);
     }
     else
         await this.monkeyTable.UpdateAsync(item);
 }
 internal async Task<IEnumerable<MobileServiceFile>> GetImageFiles(Monkey monkey)
 {
     // FILES: Get files (local)
     //if (requiresServerPull)
     //    await this.monkeyTable.PullFilesAsync(todoItem);
     return await this.monkeyTable.GetFilesAsync(monkey);
 }
        internal async Task DeleteImage(Monkey monkey, MobileServiceFile file)
        {
            // FILES: Deleting file
            await this.monkeyTable.DeleteFileAsync(file);

            // "Touch" the record to mark it as updated
            await this.monkeyTable.UpdateAsync(monkey);
        }
        internal async Task<MobileServiceFile> AddImage(Monkey monkey, string imagePath)
        {
            string targetPath = fileHelper.CopyFileToAppDirectory(monkey.Id, imagePath);

            // FILES: Creating/Adding file
            MobileServiceFile file = await this.monkeyTable.AddFileAsync(monkey, Path.GetFileName(targetPath));


            // "Touch" the record to mark it as updated
            await this.monkeyTable.UpdateAsync(monkey);

            return file;
        }
 public async Task DeleteMonkeyAsync(Monkey item)
 {
     try
     {
         await monkeyTable.DeleteAsync(item);
     }
     catch (MobileServiceInvalidOperationException msioe)
     {
         Debug.WriteLine(@"INVALID {0}", msioe.Message);
     }
     catch (Exception e)
     {
         Debug.WriteLine(@"ERROR {0}", e.Message);
     }
 }