Beispiel #1
0
        public async Task <ActionResult <CapturedPasswordCredential> > CreatePasswordCredential([FromBody] CapturedPasswordCredential credential)
        {
            try
            {
                CapturedPasswordCredential addedCredential = await _context.CreatePasswordCredential(credential);

                return(CreatedAtRoute(nameof(GetPasswordCredential), new { id = addedCredential.Id }, addedCredential));
            }
            catch (ControllerNotFoundException e)
            {
                return(NotFound(e.Message));
            }
            catch (ControllerBadRequestException e)
            {
                return(BadRequest(e.Message));
            }
            catch (ControllerUnauthorizedException)
            {
                return(new UnauthorizedResult());
            }
        }
Beispiel #2
0
        public async Task <IActionResult> CreatePasswordCredential(CapturedPasswordCredential credential)
        {
            CapturedCredential createdCredential = await _context.CreatePasswordCredential(credential);

            return(RedirectToAction("Index", "Data"));
        }