예제 #1
0
 public MonkeyViewModel(Monkey monkey)
 {
     Monkey = monkey;
 }
예제 #2
0
 public async Task SaveMonkeyAsync(Monkey item)
 {
     if (item.Id == null)
     {
         await this.monkeyTable.InsertAsync(item);
     }
     else
         await this.monkeyTable.UpdateAsync(item);
 }
예제 #3
0
 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);
 }
예제 #4
0
        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);
        }
예제 #5
0
        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;
        }
예제 #6
0
 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);
     }
 }