public IActionResult OnPost(int UserID, int RouteID) { try { Request request = new Request(); request.UserId = userID; request.RouteId = RouteID; request.Message = Request.Form["RequestMessage"]; _routeService.AddRequest(request); RequestCheck = _routeService.CheckRequest(userID, RouteID); RouteProperty = _routeService.GetOneRoute(RouteID); ProfilePicture = _iPicture.GetProfilePicture(userID); SuccesApply = "You have succesfully applied to this route"; return(Page()); } catch (Exception e) { ErrorMessage = "An error occoured, you probably wrote over the 500 character limit"; ProfilePicture = _iPicture.GetProfilePicture(userID); RouteProperty = _routeService.GetOneRoute(RouteID); RequestCheck = _routeService.CheckRequest(userID, RouteID); Passengers = _routeService.GetAllPassengerUsers(RouteID); return(Page()); } }