public void Add(UserSession session) { var model = UserSessionModel.FromRepositoryType(session); var sql = @" INSERT INTO UserSessionModels ( CreationTimeStamp, LastContactTimeStamp, Token, User_Id ) VALUES ( @CreationTimeStamp, @LastContactTimeStamp, @Token, @User_Id ) SELECT CAST(IDENT_CURRENT('UserSessionModels') as int) "; var parameters = new { CreationTimeStamp = model.CreationTimeStamp, LastContactTimeStamp = model.LastContactTimeStamp, Token = model.Token, User_Id = model.User_Id, }; var id = _connection.QuerySingle <int>(sql, parameters); session.SetId(id); }
public void Update(UserSession session) { var model = UserSessionModel.FromRepositoryType(session); var sql = @" UPDATE UserSessionModels SET LastContactTimeStamp = @LastContactTimeStamp "; var parameters = new { LastContactTimeStamp = model.LastContactTimeStamp }; _connection.Execute(sql, parameters); }