public async Task <ActionResult <IEnumerable <PriceList> > > GetPriceList() { try { var price = await _repository.GetPriceList(); return(Ok(price)); } catch (Exception exc) { _logger.LogError($"Error: {exc}"); // transaction.Rollback(); return(NotFound()); } }
private void MainForm_Load(object sender, EventArgs e) { try { str_menu_item_AllHotelRooms_Click(sender, e); var priceList = _priceListRepository.GetPriceList().ToList(); var finalPriceList = from l in priceList select new { RoomType = l.TypeOfRoom, Rate = l.Rate, PlacesCount = l.PlacesCount }; Text = string.Format("Apartment Booking: {0} {1}", CurrentUser.FirstName, CurrentUser.SecondName); dgv_PriceList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgv_PriceList.DataSource = finalPriceList.ToList(); } catch (SqlException exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (ArgumentNullException exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }