示例#1
0
        public async Task <CipherResponseModel> Post([FromBody] CipherRequestModel model)
        {
            var userId = _userService.GetProperUserId(User).Value;
            var cipher = model.ToCipherDetails(userId);
            await _cipherService.SaveDetailsAsync(cipher, userId);

            var response = new CipherResponseModel(cipher, _globalSettings);

            return(response);
        }
示例#2
0
        public async Task <LoginResponseModel> Post([FromBody] LoginRequestModel model)
        {
            var userId = _userService.GetProperUserId(User).Value;
            var login  = model.ToCipherDetails(userId);
            await _cipherService.SaveDetailsAsync(login, userId);

            var response = new LoginResponseModel(login);

            return(response);
        }
示例#3
0
        public async Task <CipherResponseModel> Post([FromBody] CipherRequestModel model)
        {
            var userId = _userService.GetProperUserId(User).Value;
            var cipher = model.ToCipherDetails(userId);

            if (cipher.OrganizationId.HasValue && !_currentContext.OrganizationUser(cipher.OrganizationId.Value))
            {
                throw new NotFoundException();
            }

            await _cipherService.SaveDetailsAsync(cipher, userId, null, cipher.OrganizationId.HasValue);

            var response = new CipherResponseModel(cipher, _globalSettings);

            return(response);
        }