public async Task <IActionResult> TrailerRequest(string registrationNumber) { try { if (registrationNumber != null) { var user = await UserManager.GetUserAsync(User); var driver = DriverService.GetByUserId(user.Id); var request = DriverService.CreateRequest(driver.Id, registrationNumber); await RequestHub.Clients.All.SendAsync("AddRequest", request); } return(RedirectToAction("Index")); } catch (Exception e) { Logger.LogDebug("Failed to make trailer request {@Exception}", e); Logger.LogError("Failed to make trailer request {Exception}", e.Message); return(BadRequest()); } }