public IActionResult AddGuestOnCheckin(string FullName, string Gender, string IdCard, int bookingid) { if (!GuestDAO.CheckIsExistGuestByIdCard(IdCard)) { var guestid = GuestDAO.InsertGuest(new Guest() { FullName = FullName, Gender = Gender, IDCardNumber = IdCard }); var stay = StayDAO.InsertStay(new Stay() { GuestID = guestid, BookingID = bookingid, FromDate = DateTime.Now, ToDate = null }); return(Json(stay)); } else { var guestid = GuestDAO.GetGuestByIdCardNumber(IdCard).GuestID; if (!StayDAO.CheckGuestStaying(guestid)) { var stay = StayDAO.InsertStay(new Stay() { GuestID = guestid, BookingID = bookingid, FromDate = DateTime.Now, ToDate = null }); return(Json(stay)); } else { return(Json(null)); } } }