public ActionResult CheckReservation(AdminReservationData Data) { AdminConfirmReservation ConfirmReservation = new AdminConfirmReservation(); Guest Guest = GuestStore.GetGuestByNationalId(Data.NationaltyID); if (Guest != null) { ConfirmReservation.Gender = Guest.Gender; ConfirmReservation.GuestAddress = Guest.GuestAddress; ConfirmReservation.GuestCode = Guest.GuestCode; ConfirmReservation.GuestName = Guest.GuestName; ConfirmReservation.Nationality = Guest.Nationality; ConfirmReservation.PhoneNumber = Guest.PhoneNumber; } int result = RoomStore.CheckForReservation(new BooKingDataForm { StartDate = Data.StartDate, EndDate = Data.EndDate, Category = Data.CategoryID, Bed = Data.NumOfBedId }); if (result > 0) { RoomDetail RoomData = RoomStore.GetRoomById(result); ConfirmReservation.Room = new RoomsList { RoomId = RoomData.RoomDetailscode, RoomNum = RoomData.RoomNumber }; ConfirmReservation.TotalPrice = RoomStore.RecervationPrice(new BooKingDataForm { StartDate = Data.StartDate, EndDate = Data.EndDate, Category = Data.CategoryID, Bed = Data.NumOfBedId }); } return(Json(ConfirmReservation, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> Register(RegisterUserGuest Data) { User user; Guest guest; user = UserStore.checkEmail(Data.Email); if (user == null) { guest = GuestStore.GetGuestByNationalId(Data.NationalID); if (guest == null) { int result = await UserStore.AddUser(user = new User { UserEmail = Data.Email, UserPassword = Data.PassWord, RoleId = 2 }); if (result != 0) { int result2 = await GuestStore.AddGuest(guest = new Guest { UserId = user.UserCode, GuestName = Data.GuestName, PhoneNumber = Data.PhoneNumber, NationalID = Data.NationalID, Nationality = Data.Nationality, Gender = Data.Gender, GuestAddress = Data.GuestAddress }); if (result2 != 0) { return(View("Index")); } } } } return(View("LogIn")); }