public async Task<IActionResult> PutCheckoutList(int id, CheckoutList checkoutList)
        {
            if (id != checkoutList.CheckoutId)
            {
                return BadRequest();
            }

            _context.Entry(checkoutList).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CheckoutListExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return NoContent();
        }
예제 #2
0
        private void Btn_CheckOut_Click(object sender, RoutedEventArgs e)
        {
            Bookings book = (Bookings)Grd_book.SelectedItem;

            bookings.Remove(book);
            CheckoutList checkout = new CheckoutList {
                roomNumber = book.booked_roomnr, name = book.name, identityNr = book.identitynr, checkoutDate = DateTime.Today.ToLocalTime()
            };

            checkoutLists.Add(checkout);
            MessageBox.Show("CheckOut Completed", "Thank You", MessageBoxButton.OK, MessageBoxImage.Information);
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create the presenter and pass in the view (this) and our repository. (Fake DB layer)
            var presenter = new CheckOutPresenter(this, new CheckoutRepository());

            // Use Presenter to get the Ordered list.
            // This binds the results to the view property 'CheckoutItems'
            presenter.GetItemsOrderedByPrice();

            CheckoutList.DataSource    = CheckoutItems;
            CheckoutList.DataTextField = "Description";
            CheckoutList.DataBind();

            // Use Presenter to get the running total.
            // This binds the results to the view property 'RunningTotal'
            presenter.GetRunningTotal();

            CheckoutTotal.Text = RunningTotal.ToString();
        }
        public async Task<ActionResult<CheckoutList>> PostCheckoutList(CheckoutList checkoutList)
        {
            _context.CheckoutLists.Add(checkoutList);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (CheckoutListExists(checkoutList.CheckoutId))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtAction("GetCheckoutList", new { id = checkoutList.CheckoutId }, checkoutList);
        }