Пример #1
0
 public async Task <IActionResult> Edit(EmbeddedResource resource)
 {
     try
     {
         return(View(await _context.EditEmbeddedResource(resource)));
     }
     catch (Exception e) when(e is ControllerNotFoundException || e is ControllerBadRequestException || e is ControllerUnauthorizedException)
     {
         return(RedirectToAction(nameof(Edit), new { id = resource.Id }));
     }
 }
Пример #2
0
 public async Task <ActionResult <EmbeddedResource> > EditEmbeddedResource([FromBody] EmbeddedResource resource)
 {
     try
     {
         return(await _context.EditEmbeddedResource(resource));
     }
     catch (ControllerNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (ControllerBadRequestException e)
     {
         return(BadRequest(e.Message));
     }
     catch (ControllerUnauthorizedException)
     {
         return(new UnauthorizedResult());
     }
 }