public async Task <IActionResult> CreateBridge(BridgeListener listener) { try { listener = await _context.CreateBridgeListener(_userManager, _configuration, listener, _ListenerCancellationTokens, _eventhub); return(RedirectToAction(nameof(Index))); } catch (Exception e) when(e is ControllerNotFoundException || e is ControllerBadRequestException || e is ControllerUnauthorizedException) { ModelState.AddModelError(string.Empty, e.Message); ViewBag.Profiles = await _context.GetHttpProfiles(); ViewBag.ListenerTypes = await _context.GetListenerTypes(); return(RedirectToAction(nameof(Create))); } }
public async Task <IActionResult> CreateBridge(BridgeListener listener) { try { listener = await _context.CreateBridgeListener(_userManager, _configuration, listener, _ListenerCancellationTokens, _eventhub); return(RedirectToAction(nameof(Index))); } catch (Exception e) when(e is ControllerNotFoundException || e is ControllerBadRequestException || e is ControllerUnauthorizedException) { ModelState.AddModelError(string.Empty, e.Message); ViewBag.Profiles = (await _context.GetBridgeProfiles()).FirstOrDefault().Id; ViewBag.ListenerType = (await _context.GetListenerTypes()).FirstOrDefault(LT => LT.Name == "Bridge"); BridgeProfile profile = (await _context.GetBridgeProfiles()).FirstOrDefault(); return(View(new BridgeListener { ListenerTypeId = ViewBag.ListenerType.Id, ProfileId = profile.Id, Profile = profile })); } }