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, "")); }
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, "不存在")); } }
public async Task <Res <object> > Update(KeySecretOutput input) { return(await _httpService.PostJson <Res <object> >("/api/Worker/KeySecret/Update", input)); }