Exemplo n.º 1
0
        private void btnReservationAdd_Click(object sender, EventArgs e)
        {
            status = DateTime.Compare(DateTime.Now, dteDateIn.DateTime.Date);
            Guest guest = GuestControl();

            try
            {
                if (guest == null)
                {
                    _guestService.Add(new Guest
                    {
                        FirstName = txbGuestName.Text,
                        LastName  = txbGuestLastName.Text,
                        TCIdNo    = txbTCIdNo.Text
                    });
                }
                GuestControl();

                _reservationService.Add(new Reservation
                {
                    GuestId = guest.Id,
                    RoomId  = Convert.ToInt32(dgwEmptyRooms.SelectedRows[0].Cells[0].Value),
                    DateIn  = dteDateIn.DateTime.Date,
                    DateOut = dteDateOut.DateTime.Date,
                    Status  = status
                });
                MessageBox.Show("Kayıt Yapıldı");
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Kayıt Başarısız");
            }
            this.Close();
        }
Exemplo n.º 2
0
        public async Task <IActionResult> CreateGuest([FromBody] GuestDto guest)
        {
            if (guest == null)
            {
                return(BadRequest());
            }

            await _guestService.Add(guest);

            return(Created("Created new Guest", guest));
        }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_guestToEdit == null)
            {
                Guest guest = new Guest();
                guest.TCIdNo    = txtID.Text;
                guest.FirstName = txtFirstName.Text;
                guest.LastName  = txtLastName.Text;
                _guestService.Add(guest);
                MessageBox.Show("Kayıt Ekleme Başarılı");

                this.Close();
            }
            else
            {
                _guestToEdit.TCIdNo    = txtID.Text;
                _guestToEdit.FirstName = txtFirstName.Text;
                _guestToEdit.LastName  = txtLastName.Text;
                _guestService.Update(_guestToEdit);
                MessageBox.Show("Kayıt Düzenleme Başarılı");
                Close();
            }
        }