Esempio n. 1
0
        public async Task <ActionResult <CapturedHashCredential> > CreateHashCredential([FromBody] CapturedHashCredential credential)
        {
            try
            {
                CapturedHashCredential addedCredential = await _context.CreateHashCredential(credential);

                return(CreatedAtRoute(nameof(GetHashCredential), new { id = addedCredential.Id }, addedCredential));
            }
            catch (ControllerNotFoundException e)
            {
                return(NotFound(e.Message));
            }
            catch (ControllerBadRequestException e)
            {
                return(BadRequest(e.Message));
            }
            catch (ControllerUnauthorizedException)
            {
                return(new UnauthorizedResult());
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> CreateHashCredential(CapturedHashCredential credential)
        {
            CapturedCredential createdCredential = await _context.CreateHashCredential(credential);

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