public async Task <Expense> SaveExpense(Expense item) { try { item.IsDirty = false; //if it is new then inser record, else update! if (string.IsNullOrWhiteSpace(item.AzureId)) { await azureService.InsertExpenseAsync(item); } else { await azureService.UpdateExpenseAsync(item); } } catch (Exception ex) { item.IsDirty = true; //unable to sync dialog.SendMessage(ex.Message, "Problem!"); } return(await Task.Factory.StartNew(() => { var id = db.SaveItem <Expense>(item); item.Id = id; return item; })); }
public Task <Expense> SaveExpense(Expense item) { return(Task.Factory.StartNew(() => { var id = db.SaveItem <Expense>(item); item.Id = id; return item; })); }