private async void buttonPlaceOrder_Click(object sender, EventArgs e) { var token = _cache.Get(UserDataEnum.Token); if (token == null) { _loginForm.ShowDialog(this); return; } var order = new Order { UserId = (long)_cache.Get(UserDataEnum.UserId), Comments = richTextBoxComments.Text, DeliveryAddress = textBoxAddress.Text, CustomerPhone = textBoxPhoneNumber.Text, OrderFood = _orderFood, OrderAdditives = _orderAdditives, PaymentMethod = radioButtonCard.Checked ? PaymentMethod.Card : PaymentMethod.Cash, Status = "placed", StatusDate = DateTime.Now, TotalPrice = _totalPrice }; var result = await _apiHandler.PlaceOrderAsync(order); if (result) { MessageBox.Show("Order was successfully placed", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("We couldn't place the order :(", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }