// View for registration success public IActionResult RegisterRoomBooking([Bind] RoomBookingModel booking) { WebDbContext db = HttpContext.RequestServices.GetService(typeof(Web.Utils.WebDbContext)) as WebDbContext; var guestid = Convert.ToInt32(HttpContext.User.FindFirstValue(ClaimTypes.Name)); ModelState.Remove("AvailableRooms"); ModelState.Remove("Room"); if (ModelState.IsValid) { // Register new room booking db.RegisterBooking(guestid, booking); // Redirect to user area ModelState.Clear(); return(View()); } return(View()); }