public async Task <IActionResult> Edit(int id, [Bind("MemeberCode,Name,Email,City,Country,NICno,PhoneNo,Address")] GuestsModel guestsModel)
        {
            if (id != guestsModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(guestsModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GuestsModelExists(guestsModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(guestsModel));
        }
        public IActionResult GetGuestByRoomId(int roomId)
        {
            var reserve = _context.Reserve.FirstOrDefault(m => m.RoomId == roomId && m.ConfirmChekout == false);

            if (reserve != null)
            {
                GuestsModel   guest     = _context.Guests.FirstOrDefault(m => m.Id == reserve.GuestId);
                BillViewModel guestBill = _context.Bill.FirstOrDefault(m => m.Id == reserve.GuestId);

                var newGuest = new
                {
                    Id        = guest.Id,
                    Name      = guest.Name,
                    Email     = guest.Email,
                    TotalBill = guestBill.TotalBill
                };

                var jaon = JsonConvert.SerializeObject(newGuest);

                return(Json(jaon));
            }
            else
            {
                var newGuest = new
                {
                    Id        = 0,
                    Name      = "Not found",
                    Email     = "Not found",
                    TotalBill = 0
                };
                var jaon = JsonConvert.SerializeObject(newGuest);
                return(Json(jaon));
            }
        }
        public async Task <IActionResult> Create([Bind("Name,GenderId,Email,City,Country,NICno,PhoneNo,Address")] GuestsModel guestsModel)
        {
            ViewBag.gender = _context.Gender.ToList();
            if (ModelState.IsValid)
            {
                _context.Add(guestsModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(guestsModel));
        }