Ejemplo n.º 1
0
 public async Task <ActionResult <CscriptLauncher> > EditCscriptLauncher([FromBody] CscriptLauncher launcher)
 {
     try
     {
         return(await _context.EditCscriptLauncher(launcher));
     }
     catch (ControllerNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (ControllerBadRequestException e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> Cscript(CscriptLauncher launcher)
        {
            try
            {
                launcher = await _context.EditCscriptLauncher(launcher);

                launcher = await _context.GenerateCscriptLauncher();

                ViewBag.Launcher  = launcher;
                ViewBag.Listeners = await _context.GetListeners();

                return(RedirectToAction(nameof(Create), new { id = launcher.Name }));
            }
            catch (Exception e) when(e is ControllerNotFoundException || e is ControllerBadRequestException || e is ControllerUnauthorizedException)
            {
                ModelState.AddModelError(string.Empty, e.Message);
                ViewBag.Launcher  = launcher;
                ViewBag.Listeners = await _context.GetListeners();

                return(RedirectToAction(nameof(Create), new { id = launcher.Name }));
            }
        }