// Handle swipe to delete event from the touch helper private void CounterItemSwipe(int postion) { CounterDelete?.Invoke(CounterItems[postion], postion); CounterItems.RemoveAt(postion); NotifyItemRangeRemoved(postion, 1); }
public async System.Threading.Tasks.Task Delete(data.InvoiceContext db, CounterDelete delete) { try { var counterToDelete = await db.Counters.FirstOrDefaultAsync(w => w.Name == delete.Name); db.Counters.Remove(counterToDelete); } catch (Exception e) { LogFactory.GetLogger().Log(LogLevel.Error, e); } }
// Delete Transaction Code public async System.Threading.Tasks.Task Delete(CounterDelete delete) { try { using (var db = new data.InvoiceContext()) { await Delete(db, delete); await db.SaveChangesAsync(); } } catch (Exception e) { LogFactory.GetLogger().Log(LogLevel.Error, e); } }