コード例 #1
0
		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}.");
		}
コード例 #2
0
		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;
		}
コード例 #3
0
		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?
		}