public void Add(WebHookSession session) { var model = WebHookSessionModel.FromRepositoryType(session); var sql = @" INSERT INTO WebHookSessionModels ( Computer_Id, LastPing, Token ) VALUES ( @Computer_Id, @LastPing, @Token ) SELECT CAST(IDENT_CURRENT('WebHookSessionModels') as int) "; var parameters = new { model.Computer_Id, model.LastPing, model.Token, }; var id = _connection.QuerySingle <int>(sql, parameters); session.SetId(id); }
public WebHookSession ToRepositoryType(IRepositoryModelCache cache, IComputerRepository computerRepository) { var result = new WebHookSession( computer: ComputerModel.ToRepositoryType(cache, Computer_Id, computerRepository), id: Id, lastPing: LastPing, token: Token ); cache?.Set(result.Id, result); return(result); }
public static WebHookSessionModel FromRepositoryType(WebHookSession repositoryModel) { if (repositoryModel == null) { return(null); } var result = new WebHookSessionModel { Computer_Id = repositoryModel.Computer.Id, Id = repositoryModel.Id, LastPing = repositoryModel.LastPing, Token = repositoryModel.Token, }; return(result); }
public void Add(WebHookSession session) { _webHookSessionRepository.Add(session); }