public async Task RemoveTicket (Ticket ticket) { var connection = dbFactory.OpenConnection (); var result = await connection.DeleteAsync (ticket); if (result != 0) throw new DbException (result, $"Can't delete Ticket entity. Error code: {result}. Entity: {ticket}."); }
public async Task<Ticket> AddTicket (Ticket ticket) { var connection = dbFactory.OpenConnection (); var result = await connection.InsertAsync (ticket); if (result != 1) throw new DbException (result, $"Can't insert Ticket entity. Error code: {result}."); return ticket; }
public async void OnAddTicket() { var userId = usersList [SelectedUserIndex].Key; var ticket = new Ticket { Title = Title, Description = Description, CreatedByUserId = userId }; await ticketsRepository.AddTicket (ticket); var mainPage = await windowManager.PopAsync (); mainPage.As<MainPageViewModel> ().UpdateTicketsList (); //WHO Should do this? }