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); }
private async Task AddCouponAsync() { var photo = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(); if (photo != null) { var coupon = new Coupon { Id = Guid.NewGuid().ToString() }; coupon.Description = "Placeholder"; var targetPath = fileHelper.CopyFileToAppDirectory(coupon.Id, photo.Path); await couponService.InsertCoupon(coupon, Path.GetFileName(targetPath)); await SearchCouponsAsync(""); } }