public async Task <AuthorizedKey> Update(Guid authorizedKeyId, [FromBody] AuthorizedKeyInput authorizedKey) { var results = await repo.Update(authorizedKeyId, authorizedKey); await WriteAuthorizationKeys(); return(results); }
public async Task <AuthorizedKey> Add([FromBody] AuthorizedKeyInput authorizedKey) { var results = await repo.Add(authorizedKey); await WriteAuthorizationKeys(); return(results); }
public async Task <AuthorizedKey> Add(AuthorizedKeyInput authorizedKey) { var entity = mapper.MapAuthorizedKey(authorizedKey, new AuthorizedKeyEntity()); this.dbContext.Add(entity); await SaveChanges(); return(mapper.MapAuthorizedKey(entity, new AuthorizedKey())); }
public async Task <AuthorizedKey> Update(Guid authorizedKeyId, AuthorizedKeyInput authorizedKey) { var entity = await this.Entity(authorizedKeyId); if (entity != null) { mapper.MapAuthorizedKey(authorizedKey, entity); await SaveChanges(); return(mapper.MapAuthorizedKey(entity, new AuthorizedKey())); } throw new KeyNotFoundException($"Cannot find authorizedKey {authorizedKeyId.ToString()}"); }
public AuthorizedKeyEntity MapAuthorizedKey(AuthorizedKeyInput src, AuthorizedKeyEntity dest) { return(mapper.Map(src, dest)); }
public static void AssertEqual(AuthorizedKeyInput expected, AuthorizedKeyEntity actual) { Assert.Equal(expected.Name, actual.Name); Assert.Equal(expected.PublicKey, actual.PublicKey); Assert.Equal(expected.Enabled, actual.Enabled); }