コード例 #1
0
        public async Task <Res <bool> > Add([FromBody] KeySecretOutput input)
        {
            _applicationDbContext.KeySecrets.Add(new KeySecret()
            {
                AccountName     = input.AccountName,
                AccountPassword = input.AccountPassword,
                Key             = input.Key,
                Secret          = input.Secret,
            });
            await _applicationDbContext.SaveChangesAsync();

            return(Res <bool> .Success(true, ""));
        }
コード例 #2
0
        public async Task <Res <bool> > Update([FromBody] KeySecretOutput input)
        {
            var rtn = await _applicationDbContext.KeySecrets.FirstOrDefaultAsync(ocr => ocr.Id == input.Id);

            if (rtn != null)
            {
                rtn.AccountName     = input.AccountName;
                rtn.Key             = input.Key;
                rtn.Secret          = input.Secret;
                rtn.AccountPassword = input.AccountPassword;
                _applicationDbContext.KeySecrets.Update(rtn);
                await _applicationDbContext.SaveChangesAsync();

                return(Res <bool> .Success(true));
            }
            else
            {
                return(Res <bool> .Success(true, "不存在"));
            }
        }
コード例 #3
0
 public async Task <Res <object> > Update(KeySecretOutput input)
 {
     return(await _httpService.PostJson <Res <object> >("/api/Worker/KeySecret/Update", input));
 }