//[OutputCache(Duration = int.MaxValue)] public ActionResult SelfService() { Guest roomGuest = null; var fullGuestName = string.Empty; var userName = string.Empty; var password = string.Empty; var myIP = GetVisitorIPAddress(); var isPresent = false; //myIP = "192.168.88.232"; if (!string.IsNullOrEmpty(myIP)) { myIP = myIP.Trim(); RoomService rm = new RoomService(); GuestService gs = new GuestService(); var room = rm.GetAll(1).FirstOrDefault(x => !string.IsNullOrEmpty(x.Notes) && x.Notes.Contains(myIP) && x.StatusId == 2); if (room != null) { roomGuest = room.GetActualRoomGuest(); var actualGuest = gs.GetById(roomGuest.Id); isPresent = actualGuest.IsPresent; actualGuest.IsPresent = true; gs.Update(actualGuest); if (roomGuest != null) { fullGuestName = roomGuest.FullName; if (!string.IsNullOrEmpty(roomGuest.Mobile)) { fullGuestName = roomGuest.Mobile + " " + fullGuestName; } userName = roomGuest.Person.Username; password = roomGuest.Person.Password; } } } return(View(new BaseViewModel { IsPresent = isPresent, FullGuestName = fullGuestName, UserName = userName, Password = password })); }