Exemple #1
0
 public async Task <ActionResult <HttpListener> > CreateHttpListener([FromBody] HttpListener listener)
 {
     try
     {
         return(await _context.CreateHttpListener(_userManager, _configuration, listener, _ListenerCancellationTokens, _eventhub));
     }
     catch (ControllerNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (ControllerBadRequestException e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemple #2
0
        public async Task <IActionResult> Create(HttpListener listener)
        {
            try
            {
                listener = await _context.CreateHttpListener(_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.ListenerType = (await _context.GetListenerTypes()).FirstOrDefault(LT => LT.Name == "HTTP");
                return(View(listener));
            }
        }