public async Task DeleteItemAsync(FocaccePost focaccePost) { try { IMobileServiceSyncTable <FocaccePost> Focacciatable = client.GetSyncTable <FocaccePost>(); await Focacciatable.DeleteAsync(focaccePost); } catch (Exception e) { throw; } }
public FocacciaPostEditViewModel(FocaccePost focaccePost) { azureService = App.AzureClient; if (focaccePost != null) { //Siamo in modifica this.Title = "Modifica Post"; NomeUtente = focaccePost.NomeUtente; Luogo = focaccePost.Luogo; DataPost = focaccePost.DataOra.Date; OraPost = focaccePost.DataOra.TimeOfDay; VisualizzaCancella = true; focaccePostInEditing = focaccePost; } else { //siamo in nuovo this.Title = "Inserimento Post"; } }
public async Task AddUpdateItemAsync(FocaccePost focaccePost) { IMobileServiceTable <FocaccePost> Focacciatable = client.GetTable <FocaccePost>(); try { if (string.IsNullOrEmpty(focaccePost.Id)) { //e' un inserimento await Focacciatable.InsertAsync(focaccePost); } else { //è una modifica await Focacciatable.UpdateAsync(focaccePost); } } //Gestione concorrenza catch (MobileServicePreconditionFailedException <FocaccePost> conflict) { FocaccePost versioneserver = conflict.Item; //Qui si può decidere che fare //Vince il server //Non devo fare nulla //Vince il client focaccePost.Version = versioneserver.Version; await Focacciatable.UpdateAsync(focaccePost); } catch (Exception e) { throw; } }
public async Task AddUpdateItemAsync(FocaccePost focaccePost) { IMobileServiceTable <FocaccePost> Focacciatable = client.GetTable <FocaccePost>(); try { if (string.IsNullOrEmpty(focaccePost.Id)) { //e' un inserimento await Focacciatable.InsertAsync(focaccePost); } else { //è una modifica await Focacciatable.UpdateAsync(focaccePost); } } catch (Exception e) { throw; } }
public FocacciaPostEditPage(FocaccePost focaccePost) { InitializeComponent(); BindingContext = vm = new FocacciaPostEditViewModel(focaccePost); }